mirror of
https://github.com/zed-industries/zed.git
synced 2024-12-28 20:01:33 +00:00
Fix unsafe memory access when converting entity handles
This commit is contained in:
parent
4b533c339d
commit
7a6010e7dc
1 changed files with 4 additions and 3 deletions
|
@ -4451,7 +4451,7 @@ impl AnyViewHandle {
|
||||||
handle_id: self.handle_id,
|
handle_id: self.handle_id,
|
||||||
});
|
});
|
||||||
unsafe {
|
unsafe {
|
||||||
Arc::decrement_strong_count(&self.ref_counts);
|
Arc::decrement_strong_count(Arc::as_ptr(&self.ref_counts));
|
||||||
}
|
}
|
||||||
std::mem::forget(self);
|
std::mem::forget(self);
|
||||||
result
|
result
|
||||||
|
@ -4517,8 +4517,9 @@ impl<T: View> From<ViewHandle<T>> for AnyViewHandle {
|
||||||
#[cfg(any(test, feature = "test-support"))]
|
#[cfg(any(test, feature = "test-support"))]
|
||||||
handle_id: handle.handle_id,
|
handle_id: handle.handle_id,
|
||||||
};
|
};
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
Arc::decrement_strong_count(&handle.ref_counts);
|
Arc::decrement_strong_count(Arc::as_ptr(&handle.ref_counts));
|
||||||
}
|
}
|
||||||
std::mem::forget(handle);
|
std::mem::forget(handle);
|
||||||
any_handle
|
any_handle
|
||||||
|
@ -4580,7 +4581,7 @@ impl AnyModelHandle {
|
||||||
handle_id: self.handle_id,
|
handle_id: self.handle_id,
|
||||||
});
|
});
|
||||||
unsafe {
|
unsafe {
|
||||||
Arc::decrement_strong_count(&self.ref_counts);
|
Arc::decrement_strong_count(Arc::as_ptr(&self.ref_counts));
|
||||||
}
|
}
|
||||||
std::mem::forget(self);
|
std::mem::forget(self);
|
||||||
result
|
result
|
||||||
|
|
Loading…
Reference in a new issue