Fix memory leak of ProjectPanel
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
parent
2e9bdfbeac
commit
76ad563b45
1 changed files with 4 additions and 2 deletions
|
@ -161,7 +161,7 @@ impl ProjectPanel {
|
||||||
this
|
this
|
||||||
});
|
});
|
||||||
cx.subscribe(&project_panel, {
|
cx.subscribe(&project_panel, {
|
||||||
let project_panel = project_panel.clone();
|
let project_panel = project_panel.downgrade();
|
||||||
move |workspace, _, event, cx| match event {
|
move |workspace, _, event, cx| match event {
|
||||||
&Event::OpenedEntry {
|
&Event::OpenedEntry {
|
||||||
entry_id,
|
entry_id,
|
||||||
|
@ -180,7 +180,9 @@ impl ProjectPanel {
|
||||||
)
|
)
|
||||||
.detach_and_log_err(cx);
|
.detach_and_log_err(cx);
|
||||||
if !focus_opened_item {
|
if !focus_opened_item {
|
||||||
cx.focus(&project_panel);
|
if let Some(project_panel) = project_panel.upgrade(cx) {
|
||||||
|
cx.focus(&project_panel);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue