From c2c27c1b372c12d93a084e5c87d806dde17f5f81 Mon Sep 17 00:00:00 2001 From: Victor Berger Date: Sun, 14 May 2017 15:28:27 +0200 Subject: [PATCH] wayland: Fix deadlock in poll_events --- src/platform/linux/wayland/event_loop.rs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/platform/linux/wayland/event_loop.rs b/src/platform/linux/wayland/event_loop.rs index 60163e28..48b81bd4 100644 --- a/src/platform/linux/wayland/event_loop.rs +++ b/src/platform/linux/wayland/event_loop.rs @@ -160,16 +160,18 @@ impl EventsLoop { self.ctxt.dispatch_pending(); evq_guard.dispatch_pending().expect("Wayland connection unexpectedly lost"); - let mut sink_guard = self.sink.lock().unwrap(); + { + let mut sink_guard = self.sink.lock().unwrap(); - // events where probably dispatched, process resize - let ids_guard = self.decorated_ids.lock().unwrap(); - sink_guard.with_callback( - |cb| Self::process_resize(&mut evq_guard, &ids_guard, cb) - ); + // events where probably dispatched, process resize + let ids_guard = self.decorated_ids.lock().unwrap(); + sink_guard.with_callback( + |cb| Self::process_resize(&mut evq_guard, &ids_guard, cb) + ); - // replace the old noop callback - unsafe { self.sink.lock().unwrap().set_callback(old_cb) }; + // replace the old noop callback + unsafe { sink_guard.set_callback(old_cb) }; + } if self.cleanup_needed.swap(false, ::std::sync::atomic::Ordering::Relaxed) { self.prune_dead_windows()