From b800fe96d2983c32144621a50a21436cd32e44ed Mon Sep 17 00:00:00 2001 From: Conrad Irwin Date: Mon, 12 Feb 2024 20:01:09 -0700 Subject: [PATCH] Fix dealloc of MacWindow (#7708) We see some panics in the Drop handler for MacWindow Looking into this, I noticed that our drop implementation was not correctly cleaning up the window state. Release Notes: - N/A --- crates/gpui/src/platform/mac/window.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/gpui/src/platform/mac/window.rs b/crates/gpui/src/platform/mac/window.rs index da42f919a5..f57f6cfe5a 100644 --- a/crates/gpui/src/platform/mac/window.rs +++ b/crates/gpui/src/platform/mac/window.rs @@ -40,7 +40,7 @@ use raw_window_handle::{ use smallvec::SmallVec; use std::{ any::Any, - cell::{Cell, RefCell}, + cell::Cell, ffi::{c_void, CStr}, mem, ops::Range, @@ -1086,7 +1086,7 @@ unsafe fn get_window_state(object: &Object) -> Arc> { unsafe fn drop_window_state(object: &Object) { let raw: *mut c_void = *object.get_ivar(WINDOW_STATE_IVAR); - Rc::from_raw(raw as *mut RefCell); + Arc::from_raw(raw as *mut Mutex); } extern "C" fn yes(_: &Object, _: Sel) -> BOOL {