Merge pull request #1534 from zed-industries/fix-crash-on-window-close

Antonio Scandurra created

Fix crash when closing a window while in full-screen mode

Change summary

crates/gpui/src/platform/mac/window.rs | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)

Detailed changes

crates/gpui/src/platform/mac/window.rs 🔗

@@ -458,9 +458,15 @@ impl Window {
 
 impl Drop for Window {
     fn drop(&mut self) {
-        unsafe {
-            self.0.as_ref().borrow().native_window.close();
-        }
+        let this = self.0.borrow();
+        let window = this.native_window;
+        this.executor
+            .spawn(async move {
+                unsafe {
+                    window.close();
+                }
+            })
+            .detach();
     }
 }