Fix window double borrows (#23739)
Fix bugs caused by the window context PR, where the window could be on the stack and is then requested from the App. This PR also adds derive macros for `AppContext` and `VisualContext` so that it's easy to define further contexts in API code, such as `editor::BlockContext`. Release Notes: - N/A
This commit is contained in:
parent
29bfb56739
commit
a7c549b85b
24 changed files with 465 additions and 297 deletions
|
@ -1200,8 +1200,7 @@ fn show_keymap_file_json_error(
|
|||
cx.emit(DismissEvent);
|
||||
})
|
||||
})
|
||||
})
|
||||
.log_err();
|
||||
});
|
||||
}
|
||||
|
||||
fn show_keymap_file_load_error(
|
||||
|
@ -1245,7 +1244,6 @@ fn show_keymap_file_load_error(
|
|||
})
|
||||
})
|
||||
})
|
||||
.log_err();
|
||||
})
|
||||
.ok();
|
||||
})
|
||||
|
|
|
@ -9,7 +9,6 @@ use gpui::{AnyWindowHandle, App, AppContext as _, Context, Entity, WeakEntity, W
|
|||
use language::language_settings::{all_language_settings, InlineCompletionProvider};
|
||||
use settings::SettingsStore;
|
||||
use supermaven::{Supermaven, SupermavenCompletionProvider};
|
||||
use workspace::Workspace;
|
||||
use zed_predict_tos::ZedPredictTos;
|
||||
|
||||
pub fn init(client: Arc<Client>, user_store: Entity<UserStore>, cx: &mut App) {
|
||||
|
@ -115,8 +114,9 @@ pub fn init(client: Arc<Client>, user_store: Entity<UserStore>, cx: &mut App) {
|
|||
return;
|
||||
};
|
||||
|
||||
let Some(workspace) =
|
||||
window.downcast::<Workspace>().and_then(|w| w.root(cx).ok())
|
||||
let Some(Some(workspace)) = window
|
||||
.update(cx, |_, window, _| window.root().flatten())
|
||||
.ok()
|
||||
else {
|
||||
return;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue