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.

remote project: Fix project reference leak when waiting for prompt reply (#19838)

Thorsten Ballfab2f22a8944
diff --git a/crates/project/src/project.rs b/crates/project/src/project.rs
index 04ae203b4d2..eb5edabc8e6 100644
--- a/crates/project/src/project.rs
+++ b/crates/project/src/project.rs
@@ -3603,6 +3603,13 @@ impl Project {
anyhow::Ok(())
})??;
+ // We drop `this` to avoid holding a reference in this future for too
+ // long.
+ // If we keep the reference, we might not drop the `Project` early
+ // enough when closing a window and it will only get releases on the
+ // next `flush_effects()` call.
+ drop(this);
+
let answer = rx.next().await;
Ok(LanguageServerPromptResponse {