diff --git a/crates/notebook/src/background.rs b/crates/notebook/src/background.rs index d713fbb37ec1fb3295ea946589cef83e7e92fc16..3c38eae5c1bb4957f896617a9741f5c73dc76fc8 100644 --- a/crates/notebook/src/background.rs +++ b/crates/notebook/src/background.rs @@ -459,7 +459,8 @@ impl Background { self.0.touched(paths); } - /// Each watched section's status, in watch order; held sections report their live state. + /// Each watched section's status, in watch order: a held section's live state while its + /// session syncs, otherwise this thread's last check of it. pub fn status(&self) -> Vec<(String, SyncStatus)> { let sections: Vec<_> = self.0.watched.lock().map_or_else( |_| Vec::new(), @@ -489,7 +490,8 @@ impl Background { .into_iter() .map(|(path, fallback, held)| { let live = held.and_then(|held| { - let worker = held.worker.upgrade()?; + let worker = (held.worker.upgrade()) + .filter(|worker| !worker.stopped.load(Ordering::Acquire))?; let replica = held.replica.upgrade()?; let observed = held.observed.upgrade()?; let synced =