From 83a844f12081bb21138fa2a0d49cc2bf646eea4e Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Fri, 7 May 2021 14:05:05 -0700 Subject: [PATCH] Fix the Clone impl for AnyViewHandle --- gpui/src/app.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/gpui/src/app.rs b/gpui/src/app.rs index 33899fc77a..43c5417308 100644 --- a/gpui/src/app.rs +++ b/gpui/src/app.rs @@ -2389,7 +2389,6 @@ impl Handle for ViewHandle { } } -#[derive(Clone)] pub struct AnyViewHandle { window_id: usize, view_id: usize, @@ -2425,6 +2424,18 @@ impl AnyViewHandle { } } +impl Clone for AnyViewHandle { + fn clone(&self) -> Self { + self.ref_counts.lock().inc_entity(self.view_id); + Self { + window_id: self.window_id, + view_id: self.view_id, + view_type: self.view_type, + ref_counts: self.ref_counts.clone(), + } + } +} + impl From<&ViewHandle> for AnyViewHandle { fn from(handle: &ViewHandle) -> Self { handle.ref_counts.lock().inc_entity(handle.view_id);