Ensure no borrows are held when activating window or creating prompts

This commit is contained in:
Antonio Scandurra 2022-07-13 10:37:55 +02:00
parent d4e0f73ffe
commit c53fa4941a

View file

@ -392,18 +392,33 @@ impl platform::Window for Window {
});
let block = block.copy();
let native_window = self.0.borrow().native_window;
let _: () = msg_send![
alert,
beginSheetModalForWindow: native_window
completionHandler: block
];
self.0
.borrow()
.executor
.spawn(async move {
let _: () = msg_send![
alert,
beginSheetModalForWindow: native_window
completionHandler: block
];
})
.detach();
done_rx
}
}
fn activate(&self) {
let window = self.0.borrow().native_window;
unsafe { msg_send![window, makeKeyAndOrderFront: nil] }
self.0
.borrow()
.executor
.spawn(async move {
unsafe {
let _: () = msg_send![window, makeKeyAndOrderFront: nil];
}
})
.detach();
}
fn set_title(&mut self, title: &str) {