From 8ed575ff4a4f0961bb2e784bda1ae109c6bd37b7 Mon Sep 17 00:00:00 2001 From: Osspial Date: Sun, 9 Sep 2018 00:19:53 -0400 Subject: [PATCH] Update send test and errors that broke some examples/APIs --- examples/handling_close.rs | 3 +-- src/platform_impl/windows/window.rs | 2 +- tests/send_objects.rs | 6 ++++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/examples/handling_close.rs b/examples/handling_close.rs index a2db1216b..31f17da33 100644 --- a/examples/handling_close.rs +++ b/examples/handling_close.rs @@ -17,6 +17,7 @@ fn main() { event_loop.run(move |event, _, control_flow| { use winit::event::ElementState::Released; use winit::event::VirtualKeyCode::{N, Y}; + *control_flow = ControlFlow::Wait; match event { Event::WindowEvent { event, .. } => match event { @@ -71,7 +72,5 @@ fn main() { }, _ => (), } - - *control_flow = ControlFlow::Wait; }); } diff --git a/src/platform_impl/windows/window.rs b/src/platform_impl/windows/window.rs index e50856bac..8140cc19e 100644 --- a/src/platform_impl/windows/window.rs +++ b/src/platform_impl/windows/window.rs @@ -448,6 +448,7 @@ impl Window { let window_state_lock = self.window_state.lock(); // We don't want to increment/decrement the display count more than once! if hide == window_state_lock.cursor_hidden { return; } + drop(window_state_lock); let (tx, rx) = channel(); let window_state = Arc::clone(&self.window_state); self.thread_executor.execute_in_thread(move || { @@ -455,7 +456,6 @@ impl Window { window_state.lock().cursor_hidden = hide; let _ = tx.send(()); }); - drop(window_state_lock); rx.recv().unwrap() } diff --git a/tests/send_objects.rs b/tests/send_objects.rs index d4402aaca..9220203fd 100644 --- a/tests/send_objects.rs +++ b/tests/send_objects.rs @@ -4,8 +4,10 @@ fn needs_send() {} #[test] fn event_loop_proxy_send() { - // ensures that `winit::EventLoopProxy` implements `Send` - needs_send::>(); + fn is_send() { + // ensures that `winit::EventLoopProxy` implements `Send` + needs_send::>(); + } } #[test]