mirror of
https://github.com/rust-windowing/winit.git
synced 2026-06-28 07:33:14 -04:00
macOS: fix panic during drag_window
Return error from it instead of unwrapping.
This commit is contained in:
@@ -284,8 +284,7 @@ impl CoreWindow for Window {
|
||||
}
|
||||
|
||||
fn drag_window(&self) -> Result<(), RequestError> {
|
||||
self.maybe_wait_on_main(|delegate| delegate.drag_window());
|
||||
Ok(())
|
||||
self.maybe_wait_on_main(|delegate| delegate.drag_window())
|
||||
}
|
||||
|
||||
fn drag_resize_window(
|
||||
|
||||
@@ -1171,10 +1171,12 @@ impl WindowDelegate {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn drag_window(&self) {
|
||||
pub fn drag_window(&self) -> Result<(), RequestError> {
|
||||
let mtm = MainThreadMarker::from(self);
|
||||
let event = NSApplication::sharedApplication(mtm).currentEvent().unwrap();
|
||||
let event =
|
||||
NSApplication::sharedApplication(mtm).currentEvent().ok_or(RequestError::Ignored)?;
|
||||
self.window().performWindowDragWithEvent(&event);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
||||
Reference in New Issue
Block a user