add android_sync_lock to wry event handler to avoid refcell errors (#5190)
* add android_sync_lock to wry event handler to avoid refcell errors * rustfmt * move sync lock to apply_event
This commit is contained in:
1 parent
d6629acd84
commit
adfd6a12f8
1 file changed
+5
@@ -53,12 +53,17 @@ impl WindowEventHandlers {
|
|||||||
target: &EventLoopWindowTarget<UserWindowEvent>,
|
target: &EventLoopWindowTarget<UserWindowEvent>,
|
||||||
) {
|
) {
|
||||||
for (_, handler) in self.handlers.borrow_mut().iter_mut() {
|
for (_, handler) in self.handlers.borrow_mut().iter_mut() {
|
||||||
|
// Avoid interacting with the runtime while something else is using it
|
||||||
|
#[cfg(target_os = "android")]
|
||||||
|
let _lock = crate::android_sync_lock::android_runtime_lock();
|
||||||
|
|
||||||
// if this event does not apply to the window this listener cares about, continue
|
// if this event does not apply to the window this listener cares about, continue
|
||||||
if let Event::WindowEvent { window_id, .. } = event {
|
if let Event::WindowEvent { window_id, .. } = event {
|
||||||
if *window_id != handler.window_id {
|
if *window_id != handler.window_id {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
(handler.handler)(event, target)
|
(handler.handler)(event, target)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user