mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-23 22:01:31 +11:00
Fix a possible double-borrow during event handling (#1512)
This commit is contained in:
parent
0bc58f695b
commit
a8e777a5df
|
@ -1,6 +1,7 @@
|
|||
# Unreleased
|
||||
|
||||
- On X11, fix `ResumeTimeReached` being fired too early.
|
||||
- On Web, fix a possible panic during event handling
|
||||
|
||||
# 0.22.0 (2020-03-09)
|
||||
|
||||
|
|
|
@ -202,7 +202,6 @@ impl<T: 'static> Shared<T> {
|
|||
// It should only ever be called from send_event
|
||||
fn handle_event(&self, event: Event<'static, T>, control: &mut root::ControlFlow) {
|
||||
let is_closed = self.is_closed();
|
||||
|
||||
match *self.0.runner.borrow_mut() {
|
||||
Some(ref mut runner) => {
|
||||
// An event is being processed, so the runner should be marked busy
|
||||
|
@ -227,7 +226,9 @@ impl<T: 'static> Shared<T> {
|
|||
// If the runner doesn't exist and this method recurses, it will recurse infinitely
|
||||
if !is_closed && self.0.runner.borrow().is_some() {
|
||||
// Take an event out of the queue and handle it
|
||||
if let Some(event) = self.0.events.borrow_mut().pop_front() {
|
||||
// Make sure not to let the borrow_mut live during the next handle_event
|
||||
let event = { self.0.events.borrow_mut().pop_front() };
|
||||
if let Some(event) = event {
|
||||
self.handle_event(event, control);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue