feat(sdl2): bring back continuous resize patch #1077
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This seems to consistently work now (after #1072), and here is why I think that's the case:
Before, we would release the runtime lock before flushing events. These events would include things like mouse clicks, keyboard input, window resizes, etc. This meant that in the old patch, most resizes would require us to acquire the runtime lock since they were being "committed" in an event flush. However, last time we bumped up against a problematic resize: synchronous resizes, like
Window.maximize
. In this case, we already had the runtime lock when the event handler is called, so trying to acquire it again caused a deadlock.Now we no longer release the runtime lock on event flushes 🎉. This means that in every case that we resize the window, the runtime lock is already acquired, so we don't have to acquire it.
@bryphe please let me know if you can think of another scenario where resizes would be triggered without the runtime lock, or if any of my reasoning sounds funny/wrong.