linux/wayland: prevent possible panic (#8824)
Prevent a panic from arising from this case: https://github.com/zed-industries/zed/pull/8632#discussion_r1510015928 It's not really safe to dispatch any action before dropping the state borrow, because it may need to be modified.
This commit is contained in:
parent
538298378a
commit
c91969d828
1 changed files with 6 additions and 5 deletions
|
@ -558,11 +558,12 @@ impl Dispatch<wl_keyboard::WlKeyboard, ()> for WaylandClientState {
|
||||||
return TimeoutAction::Drop;
|
return TimeoutAction::Drop;
|
||||||
}
|
}
|
||||||
|
|
||||||
state_
|
let focused_window =
|
||||||
.keyboard_focused_window
|
state_.keyboard_focused_window.as_ref().unwrap().clone();
|
||||||
.as_ref()
|
|
||||||
.unwrap()
|
drop(state_);
|
||||||
.handle_input(input.clone());
|
|
||||||
|
focused_window.handle_input(input.clone());
|
||||||
|
|
||||||
TimeoutAction::ToDuration(Duration::from_secs(1) / rate)
|
TimeoutAction::ToDuration(Duration::from_secs(1) / rate)
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue