On Windows, fix deadlock during Cursor{Enter,Leave}
The lock was not released when calling back to the user. Fixes #3171.
This commit is contained in:
parent
772b21ce09
commit
d37d1a03b2
2 changed files with 5 additions and 0 deletions
|
|
@ -11,6 +11,8 @@ Unreleased` header.
|
||||||
|
|
||||||
# Unreleased
|
# Unreleased
|
||||||
|
|
||||||
|
- On Windows, fix deadlock when accessing the state during `Cursor{Enter,Leave}`.
|
||||||
|
|
||||||
# 0.29.2
|
# 0.29.2
|
||||||
|
|
||||||
- **Breaking:** Bump MSRV from `1.60` to `1.65`.
|
- **Breaking:** Bump MSRV from `1.60` to `1.65`.
|
||||||
|
|
|
||||||
|
|
@ -1465,6 +1465,7 @@ unsafe fn public_window_callback_inner<T: 'static>(
|
||||||
.set_cursor_flags(window, |f| f.set(CursorFlags::IN_WINDOW, true))
|
.set_cursor_flags(window, |f| f.set(CursorFlags::IN_WINDOW, true))
|
||||||
.ok();
|
.ok();
|
||||||
|
|
||||||
|
drop(w);
|
||||||
userdata.send_event(Event::WindowEvent {
|
userdata.send_event(Event::WindowEvent {
|
||||||
window_id: RootWindowId(WindowId(window)),
|
window_id: RootWindowId(WindowId(window)),
|
||||||
event: CursorEntered {
|
event: CursorEntered {
|
||||||
|
|
@ -1487,6 +1488,7 @@ unsafe fn public_window_callback_inner<T: 'static>(
|
||||||
.set_cursor_flags(window, |f| f.set(CursorFlags::IN_WINDOW, false))
|
.set_cursor_flags(window, |f| f.set(CursorFlags::IN_WINDOW, false))
|
||||||
.ok();
|
.ok();
|
||||||
|
|
||||||
|
drop(w);
|
||||||
userdata.send_event(Event::WindowEvent {
|
userdata.send_event(Event::WindowEvent {
|
||||||
window_id: RootWindowId(WindowId(window)),
|
window_id: RootWindowId(WindowId(window)),
|
||||||
event: CursorLeft {
|
event: CursorLeft {
|
||||||
|
|
@ -1500,6 +1502,7 @@ unsafe fn public_window_callback_inner<T: 'static>(
|
||||||
// handle spurious WM_MOUSEMOVE messages
|
// handle spurious WM_MOUSEMOVE messages
|
||||||
// see https://devblogs.microsoft.com/oldnewthing/20031001-00/?p=42343
|
// see https://devblogs.microsoft.com/oldnewthing/20031001-00/?p=42343
|
||||||
// and http://debugandconquer.blogspot.com/2015/08/the-cause-of-spurious-mouse-move.html
|
// and http://debugandconquer.blogspot.com/2015/08/the-cause-of-spurious-mouse-move.html
|
||||||
|
let mut w = userdata.window_state_lock();
|
||||||
cursor_moved = w.mouse.last_position != Some(position);
|
cursor_moved = w.mouse.last_position != Some(position);
|
||||||
w.mouse.last_position = Some(position);
|
w.mouse.last_position = Some(position);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue