Produce window::Event::Closed only if window exists

This commit is contained in:
Héctor Ramón Jiménez 2024-08-15 02:11:17 +02:00
parent 7c2abc9b8b
commit 9b99b932bc
No known key found for this signature in database
GPG key ID: 4C07CEC81AFA161F

View file

@ -1223,13 +1223,15 @@ fn run_action<P, C>(
*is_window_opening = true; *is_window_opening = true;
} }
window::Action::Close(id) => { window::Action::Close(id) => {
let _ = window_manager.remove(id); let window = window_manager.remove(id);
let _ = ui_caches.remove(&id); let _ = ui_caches.remove(&id);
events.push(( if window.is_some() {
id, events.push((
core::Event::Window(core::window::Event::Closed), id,
)); core::Event::Window(core::window::Event::Closed),
));
}
} }
window::Action::GetOldest(channel) => { window::Action::GetOldest(channel) => {
let id = let id =