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.

onboarding: Fix a double lease panic caused by Onboarding::clone_on_split (#35815)

Anthony Eidf2435f7284a4
diff --git a/crates/onboarding/src/onboarding.rs b/crates/onboarding/src/onboarding.rs
index 98f61df97b8..342b52bdda8 100644
--- a/crates/onboarding/src/onboarding.rs
+++ b/crates/onboarding/src/onboarding.rs
@@ -565,9 +565,13 @@ impl Item for Onboarding {
_: &mut Window,
cx: &mut Context<Self>,
) -> Option<Entity<Self>> {
- self.workspace
- .update(cx, |workspace, cx| Onboarding::new(workspace, cx))
- .ok()
+ Some(cx.new(|cx| Onboarding {
+ workspace: self.workspace.clone(),
+ user_store: self.user_store.clone(),
+ selected_page: self.selected_page,
+ focus_handle: cx.focus_handle(),
+ _settings_subscription: cx.observe_global::<SettingsStore>(move |_, cx| cx.notify()),
+ }))
}
fn to_item_events(event: &Self::Event, mut f: impl FnMut(workspace::item::ItemEvent)) {