Skip to content

Commit adfd6a1

Browse files
authored
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
1 parent d6629ac commit adfd6a1

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

‎packages/desktop/src/event_handlers.rs‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,17 @@ impl WindowEventHandlers {
5353
target: &EventLoopWindowTarget<UserWindowEvent>,
5454
) {
5555
for (_, handler) in self.handlers.borrow_mut().iter_mut() {
56+
// Avoid interacting with the runtime while something else is using it
57+
#[cfg(target_os = "android")]
58+
let _lock = crate::android_sync_lock::android_runtime_lock();
59+
5660
// if this event does not apply to the window this listener cares about, continue
5761
if let Event::WindowEvent { window_id, .. } = event {
5862
if *window_id != handler.window_id {
5963
continue;
6064
}
6165
}
66+
6267
(handler.handler)(event, target)
6368
}
6469
}

0 commit comments

Comments
 (0)