diff --git a/gpui/src/app.rs b/gpui/src/app.rs index 041fbca95966e9726db3a4a261ef79051145a667..9f3087bb1cd13aea74e29a4be471e3dfd10ddfe7 100644 --- a/gpui/src/app.rs +++ b/gpui/src/app.rs @@ -2363,6 +2363,14 @@ impl From> 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 { window_id: usize, view_id: usize,