mirror of
https://github.com/zed-industries/zed.git
synced 2025-02-06 18:46:49 +00:00
Prevent already dropped model from being upgraded during release
This commit is contained in:
parent
6ba5e06247
commit
9e6d865882
1 changed files with 3 additions and 3 deletions
|
@ -2618,7 +2618,7 @@ impl UpgradeModelHandle for AppContext {
|
||||||
&self,
|
&self,
|
||||||
handle: &WeakModelHandle<T>,
|
handle: &WeakModelHandle<T>,
|
||||||
) -> Option<ModelHandle<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))
|
Some(ModelHandle::new(handle.model_id, &self.ref_counts))
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
|
@ -2626,11 +2626,11 @@ impl UpgradeModelHandle for AppContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn model_handle_is_upgradable<T: Entity>(&self, handle: &WeakModelHandle<T>) -> bool {
|
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> {
|
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(
|
Some(AnyModelHandle::new(
|
||||||
handle.model_id,
|
handle.model_id,
|
||||||
handle.model_type,
|
handle.model_type,
|
||||||
|
|
Loading…
Reference in a new issue