Skip to content

Commit 8ed575f

Browse files
committed
Update send test and errors that broke some examples/APIs
1 parent bf7bfa8 commit 8ed575f

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

examples/handling_close.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ fn main() {
1717
event_loop.run(move |event, _, control_flow| {
1818
use winit::event::ElementState::Released;
1919
use winit::event::VirtualKeyCode::{N, Y};
20+
*control_flow = ControlFlow::Wait;
2021

2122
match event {
2223
Event::WindowEvent { event, .. } => match event {
@@ -71,7 +72,5 @@ fn main() {
7172
},
7273
_ => (),
7374
}
74-
75-
*control_flow = ControlFlow::Wait;
7675
});
7776
}

src/platform_impl/windows/window.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,14 +448,14 @@ impl Window {
448448
let window_state_lock = self.window_state.lock();
449449
// We don't want to increment/decrement the display count more than once!
450450
if hide == window_state_lock.cursor_hidden { return; }
451+
drop(window_state_lock);
451452
let (tx, rx) = channel();
452453
let window_state = Arc::clone(&self.window_state);
453454
self.thread_executor.execute_in_thread(move || {
454455
unsafe { Self::hide_cursor_inner(hide) };
455456
window_state.lock().cursor_hidden = hide;
456457
let _ = tx.send(());
457458
});
458-
drop(window_state_lock);
459459
rx.recv().unwrap()
460460
}
461461

tests/send_objects.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ fn needs_send<T:Send>() {}
44

55
#[test]
66
fn event_loop_proxy_send() {
7-
// ensures that `winit::EventLoopProxy` implements `Send`
8-
needs_send::<winit::event_loop::EventLoopProxy<()>>();
7+
fn is_send<T: Send>() {
8+
// ensures that `winit::EventLoopProxy` implements `Send`
9+
needs_send::<winit::event_loop::EventLoopProxy<T>>();
10+
}
911
}
1012

1113
#[test]

0 commit comments

Comments
 (0)