mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-11 21:13:02 +00:00
Remove all windows before quitting
This gives all entities a chance of running `Drop::drop` which, in turn, could cause them to spawn a critical task. For example, we use this capability when a language server is dropped and we need to asynchronously send a shutdown message.
This commit is contained in:
parent
61e06487b7
commit
f5aa07aac9
2 changed files with 8 additions and 0 deletions
|
@ -1230,6 +1230,13 @@ impl MutableAppContext {
|
|||
self.remove_dropped_entities();
|
||||
}
|
||||
|
||||
pub fn remove_all_windows(&mut self) {
|
||||
for (window_id, _) in self.cx.windows.drain() {
|
||||
self.presenters_and_platform_windows.remove(&window_id);
|
||||
}
|
||||
self.remove_dropped_entities();
|
||||
}
|
||||
|
||||
fn open_platform_window(&mut self, window_id: usize, window_options: WindowOptions) {
|
||||
let mut window =
|
||||
self.cx
|
||||
|
|
|
@ -30,6 +30,7 @@ fn main() {
|
|||
languages.set_theme(&settings.borrow().theme.editor.syntax);
|
||||
|
||||
app.on_quit(|cx| {
|
||||
cx.remove_all_windows();
|
||||
let did_finish = cx
|
||||
.background()
|
||||
.block_on_critical_tasks(Duration::from_millis(100));
|
||||
|
|
Loading…
Reference in a new issue