Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Fix retain cycle in on_app_quit (#50985)

Conrad Irwin5c481c686a7e
diff --git a/crates/gpui/src/app.rs b/crates/gpui/src/app.rs
index dbe221911a2..8af0a8923b3 100644
--- a/crates/gpui/src/app.rs
+++ b/crates/gpui/src/app.rs
@@ -744,9 +744,11 @@ impl App {
}));
platform.on_quit(Box::new({
- let cx = app.clone();
+ let cx = Rc::downgrade(&app);
move || {
- cx.borrow_mut().shutdown();
+ if let Some(cx) = cx.upgrade() {
+ cx.borrow_mut().shutdown();
+ }
}
}));