Don't allow strong view handles to be read/updated with an AsyncAppContext
This avoids an invitation to hold strong view handles across async await points, which is a common source of leaks. Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
parent
689e878bd8
commit
6317e885c7
14 changed files with 129 additions and 163 deletions
|
@ -56,7 +56,7 @@ pub fn new_journal_entry(app_state: Arc<AppState>, cx: &mut AppContext) {
|
|||
.await;
|
||||
|
||||
if let Some(Some(Ok(item))) = opened.first() {
|
||||
if let Some(editor) = item.downcast::<Editor>() {
|
||||
if let Some(editor) = item.downcast::<Editor>().map(|editor| editor.downgrade()) {
|
||||
editor.update(&mut cx, |editor, cx| {
|
||||
let len = editor.buffer().read(cx).len(cx);
|
||||
editor.change_selections(Some(Autoscroll::center()), cx, |s| {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue