mirror of
https://github.com/zed-industries/zed.git
synced 2024-12-27 10:34:53 +03:00
Prevent already dropped model from being upgraded during release
This commit is contained in:
parent
6ba5e06247
commit
9e6d865882
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user