Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix potential deadlock when opening find window
The Find object is assigned to a variable with (guarded) static storage, so the initializer of the Find object will run with a lock on the guarded variable, which turns out to be shared with all other guarded variables.
When setting up the window controller, from the Find object’s initializer, we create a “recent folders” menu which hold icons with SCM badges.
When creating these SCM icons, blocks are scheduled (asynchronously) to “fetch status”. These asynchronous blocks will need to lock the same mutex as we currently have locked (because we haven’t yet left the initializer).
The issue is that we also schedule synchronous blocks on the same queue, and that’s why we get a deadlock, because those can’t run before the asynchronous blocks have finished, yet those are waiting on the global lock that our main thread has currently obtained.
Fixes #874.
- Loading branch information
ee2c2b3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for fixing this! I ran into this a few times this afternoon.