From 0ab1094f0c974a3731a19228165c782fe714d12c Mon Sep 17 00:00:00 2001 From: Dzmitry Malyshau Date: Thu, 8 Feb 2024 21:41:15 -0800 Subject: [PATCH] linux: quit after the last window is closed (#7602) Release Notes: - N/A --- crates/gpui/src/platform/linux/platform.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/crates/gpui/src/platform/linux/platform.rs b/crates/gpui/src/platform/linux/platform.rs index 1776ee00b7e873d605f16ba3db001d45ff7efe10..b5ab1fcf93221384dec1e1df39c6e36d90a69fae 100644 --- a/crates/gpui/src/platform/linux/platform.rs +++ b/crates/gpui/src/platform/linux/platform.rs @@ -125,11 +125,8 @@ impl Platform for LinuxPlatform { // window "x" button clicked by user, we gracefully exit let window = self.state.lock().windows.remove(&ev.window()).unwrap(); window.destroy(); - if self.state.lock().windows.is_empty() { - if let Some(ref mut fun) = self.callbacks.lock().quit { - fun(); - } - } + let mut state = self.state.lock(); + state.quit_requested |= state.windows.is_empty(); } } } @@ -164,6 +161,10 @@ impl Platform for LinuxPlatform { runnable.run(); } } + + if let Some(ref mut fun) = self.callbacks.lock().quit { + fun(); + } } fn quit(&self) {