mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-07 20:39:04 +03:00
Fix panic due to re-entrantly reading Workspace
This commit is contained in:
parent
a978f3fe4f
commit
3763b985e3
@ -134,9 +134,12 @@ impl View for 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 user_store = workspace.read(cx).user_store().clone();
|
||||
let mut subscriptions = Vec::new();
|
||||
subscriptions.push(cx.observe(workspace, |_, _, cx| cx.notify()));
|
||||
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.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);
|
||||
|
||||
let project_panel = ProjectPanel::new(workspace.project().clone(), cx);
|
||||
|
Loading…
Reference in New Issue
Block a user