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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue