Implement Drop on AnyViewHandle

This was a pretty bad oversight.
This commit is contained in:
Nathan Sobo 2021-05-05 23:21:39 -06:00
parent 6cb656db9a
commit 7717700b2c

View file

@ -2363,6 +2363,14 @@ impl<T: View> From<ViewHandle<T>> for AnyViewHandle {
}
}
impl Drop for AnyViewHandle {
fn drop(&mut self) {
if let Some(ref_counts) = self.ref_counts.upgrade() {
ref_counts.lock().dec_view(self.window_id, self.view_id);
}
}
}
pub struct WeakViewHandle<T> {
window_id: usize,
view_id: usize,