Fix Workspace
references being leaked (#17497)
We noticed that the `Workspace` was never released (along with the `Project` and everything that comes along with that) when closing a window. After playing around with the LeakDetector and debugging with `cx.on_release()` callbacks, we found two culprits: the inline assistant and the outline panel. Both held strong references to `View<Workspace>` after PR #16589 and PR #16845. This PR changes both references to `WeakView<Workspace>` which fixes the leak but keeps the behaviour the same. Release Notes: - N/A Co-authored-by: Bennet <bennet@zed.dev>
This commit is contained in:
parent
e6c1c51b37
commit
54dd40878f
2 changed files with 38 additions and 24 deletions
|
@ -134,8 +134,11 @@ impl InlineAssistant {
|
|||
})
|
||||
.detach();
|
||||
|
||||
let workspace = workspace.clone();
|
||||
let workspace = workspace.downgrade();
|
||||
cx.observe_global::<SettingsStore>(move |cx| {
|
||||
let Some(workspace) = workspace.upgrade() else {
|
||||
return;
|
||||
};
|
||||
let Some(terminal_panel) = workspace.read(cx).panel::<TerminalPanel>(cx) else {
|
||||
return;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue