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 leak detector on HeadlessAppContext (#51442)

Conrad Irwin7aba1f9691c6
diff --git a/crates/gpui/src/app/headless_app_context.rs b/crates/gpui/src/app/headless_app_context.rs
index bebade89d9a..90dc8c8f0c0 100644
--- a/crates/gpui/src/app/headless_app_context.rs
+++ b/crates/gpui/src/app/headless_app_context.rs
@@ -186,6 +186,14 @@ impl HeadlessAppContext {
}
}
+impl Drop for HeadlessAppContext {
+ fn drop(&mut self) {
+ // Shut down the app so windows are closed and entity handles are
+ // released before the LeakDetector runs.
+ self.app.borrow_mut().shutdown();
+ }
+}
+
impl AppContext for HeadlessAppContext {
fn new<T: 'static>(&mut self, build_entity: impl FnOnce(&mut Context<T>) -> T) -> Entity<T> {
let mut app = self.app.borrow_mut();