Fix seg fault when using the WindowContext::on_window_should_close() API

This commit is contained in:
Mikayla 2024-01-10 11:23:18 -08:00
parent 2a09c6aad5
commit 7ef88397c9
No known key found for this signature in database
5 changed files with 13 additions and 6 deletions

View file

@ -269,6 +269,7 @@ unsafe fn build_window_class(name: &'static str, superclass: &Class) -> *const C
sel!(windowShouldClose:),
window_should_close as extern "C" fn(&Object, Sel, id) -> BOOL,
);
decl.add_method(sel!(close), close_window as extern "C" fn(&Object, Sel));
decl.add_method(
@ -685,9 +686,6 @@ impl Drop for MacWindow {
this.executor
.spawn(async move {
unsafe {
// todo!() this panic()s when you click the red close button
// unless should_close returns false.
// (luckliy in zed it always returns false)
window.close();
}
})