Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Prevent already dropped model from being upgraded during `release`
Antonio Scandurra9e6d86588227
diff --git a/crates/gpui/src/app.rs b/crates/gpui/src/app.rsindex bc38b28bba3..534f77a3490 100644--- a/crates/gpui/src/app.rs+++ b/crates/gpui/src/app.rs@@ -2618,7 +2618,7 @@ impl UpgradeModelHandle for AppContext {&self,handle: &WeakModelHandle<T>,) -> Option<ModelHandle<T>> {- if self.models.contains_key(&handle.model_id) {+ if self.ref_counts.lock().is_entity_alive(handle.model_id) {Some(ModelHandle::new(handle.model_id, &self.ref_counts))} else {None@@ -2626,11 +2626,11 @@ impl UpgradeModelHandle for AppContext {}fn model_handle_is_upgradable<T: Entity>(&self, handle: &WeakModelHandle<T>) -> bool {- self.models.contains_key(&handle.model_id)+ self.ref_counts.lock().is_entity_alive(handle.model_id)}fn upgrade_any_model_handle(&self, handle: &AnyWeakModelHandle) -> Option<AnyModelHandle> {- if self.models.contains_key(&handle.model_id) {+ if self.ref_counts.lock().is_entity_alive(handle.model_id) {Some(AnyModelHandle::new(handle.model_id,handle.model_type,