Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Fix crash in `start_display_link` (#50875)
John Tur41cfb82b1a18
diff --git a/crates/gpui_macos/src/display_link.rs b/crates/gpui_macos/src/display_link.rsindex bd1c21ca5c0..86e9b4072ba 100644--- a/crates/gpui_macos/src/display_link.rs+++ b/crates/gpui_macos/src/display_link.rs@@ -41,6 +41,7 @@ impl DisplayLink {);frame_requests.set_context(data);frame_requests.set_event_handler_f(callback);+ frame_requests.resume();let display_link = sys::DisplayLink::new(display_id,@@ -57,7 +58,6 @@ impl DisplayLink {pub fn start(&mut self) -> Result<()> {unsafe {- self.frame_requests.resume();self.display_link.as_mut().unwrap().start()?;}Ok(())@@ -65,7 +65,6 @@ impl DisplayLink {pub fn stop(&mut self) -> Result<()> {unsafe {- self.frame_requests.suspend();self.display_link.as_mut().unwrap().stop()?;}Ok(())@@ -84,8 +83,6 @@ impl Drop for DisplayLink {// We might also want to upgrade to CADisplayLink, but that requires dropping old macOS support.std::mem::forget(self.display_link.take());self.frame_requests.cancel();- // A suspended DispatchSource cannot be destroyed.- self.frame_requests.resume();}}