Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wayland: Fix deadlock in poll_events #181

Merged
merged 1 commit into from
May 14, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions src/platform/linux/wayland/event_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down