From 5c481c686a7eb542047ed231c1b95c15bdc95b8b Mon Sep 17 00:00:00 2001 From: Conrad Irwin Date: Fri, 6 Mar 2026 21:15:23 -0700 Subject: [PATCH] Fix retain cycle in on_app_quit (#50985) Updates #50970 While investigating the executor shutdown code, Claude noticed that we never actually drop the app because of a reference cycle. Release Notes: - N/A --- crates/gpui/src/app.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/gpui/src/app.rs b/crates/gpui/src/app.rs index dbe221911a2619aad11dbd31f5bbf07ca8b9fb93..8af0a8923b38a6f711d701730996afca012fb48b 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(); + } } }));