Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Checkpoint
Antonio Scandurrab6e4208ea8f4
diff --git a/crates/gpui3/src/app.rs b/crates/gpui3/src/app.rsindex 90c024f83d2..75df325508b 100644--- a/crates/gpui3/src/app.rs+++ b/crates/gpui3/src/app.rs@@ -219,7 +219,7 @@ impl AppContext {f: impl FnOnce(&mut MainThread<AppContext>) -> F + Send + 'static,) -> Task<R>where- F: Future<Output = R> + Send + 'static,+ F: Future<Output = R> + 'static,R: Send + 'static,{let this = self.this.upgrade().unwrap();diff --git a/crates/gpui3/src/executor.rs b/crates/gpui3/src/executor.rsindex d82878cf283..9b2e3ad4c37 100644--- a/crates/gpui3/src/executor.rs+++ b/crates/gpui3/src/executor.rs@@ -77,13 +77,22 @@ impl Executor {/// closure returns a future which will be run to completion on the main thread.pub fn spawn_on_main<F, R>(&self, func: impl FnOnce() -> F + Send + 'static) -> Task<R>where- F: Future<Output = R> + Send + 'static,+ F: Future<Output = R> + 'static,R: Send + 'static,{- let dispatcher = self.dispatcher.clone();- let (runnable, task) = async_task::spawn(async move { func().await }, move |runnable| {- dispatcher.dispatch_on_main_thread(runnable)- });+ let (runnable, task) = async_task::spawn(+ {+ let this = self.clone();+ async move {+ let task = this.spawn_on_main_local(func());+ task.await+ }+ },+ {+ let dispatcher = self.dispatcher.clone();+ move |runnable| dispatcher.dispatch_on_main_thread(runnable)+ },+ );runnable.schedule();Task::Spawned(task)}