Fix panic due to re-entrantly reading Workspace
This commit is contained in:
parent
a978f3fe4f
commit
3763b985e3
2 changed files with 8 additions and 3 deletions
|
@ -134,9 +134,12 @@ impl View for CollabTitlebarItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CollabTitlebarItem {
|
impl CollabTitlebarItem {
|
||||||
pub fn new(workspace: &ViewHandle<Workspace>, cx: &mut ViewContext<Self>) -> Self {
|
pub fn new(
|
||||||
|
workspace: &ViewHandle<Workspace>,
|
||||||
|
user_store: ModelHandle<UserStore>,
|
||||||
|
cx: &mut ViewContext<Self>,
|
||||||
|
) -> Self {
|
||||||
let active_call = ActiveCall::global(cx);
|
let active_call = ActiveCall::global(cx);
|
||||||
let user_store = workspace.read(cx).user_store().clone();
|
|
||||||
let mut subscriptions = Vec::new();
|
let mut subscriptions = Vec::new();
|
||||||
subscriptions.push(cx.observe(workspace, |_, _, cx| cx.notify()));
|
subscriptions.push(cx.observe(workspace, |_, _, cx| cx.notify()));
|
||||||
subscriptions.push(cx.observe(&active_call, |this, _, cx| this.active_call_changed(cx)));
|
subscriptions.push(cx.observe(&active_call, |this, _, cx| this.active_call_changed(cx)));
|
||||||
|
|
|
@ -302,7 +302,9 @@ pub fn initialize_workspace(
|
||||||
cx.emit(workspace::Event::PaneAdded(workspace.active_pane().clone()));
|
cx.emit(workspace::Event::PaneAdded(workspace.active_pane().clone()));
|
||||||
cx.emit(workspace::Event::PaneAdded(workspace.dock_pane().clone()));
|
cx.emit(workspace::Event::PaneAdded(workspace.dock_pane().clone()));
|
||||||
|
|
||||||
let collab_titlebar_item = cx.add_view(|cx| CollabTitlebarItem::new(&workspace_handle, cx));
|
let collab_titlebar_item = cx.add_view(|cx| {
|
||||||
|
CollabTitlebarItem::new(&workspace_handle, app_state.user_store.clone(), cx)
|
||||||
|
});
|
||||||
workspace.set_titlebar_item(collab_titlebar_item.into_any(), cx);
|
workspace.set_titlebar_item(collab_titlebar_item.into_any(), cx);
|
||||||
|
|
||||||
let project_panel = ProjectPanel::new(workspace.project().clone(), cx);
|
let project_panel = ProjectPanel::new(workspace.project().clone(), cx);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue