diff options
-rw-r--r-- | winit/src/program.rs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/winit/src/program.rs b/winit/src/program.rs index 57cef684..c5c3133d 100644 --- a/winit/src/program.rs +++ b/winit/src/program.rs @@ -1223,13 +1223,15 @@ fn run_action<P, C>( *is_window_opening = true; } window::Action::Close(id) => { - let _ = window_manager.remove(id); + let window = window_manager.remove(id); let _ = ui_caches.remove(&id); - events.push(( - id, - core::Event::Window(core::window::Event::Closed), - )); + if window.is_some() { + events.push(( + id, + core::Event::Window(core::window::Event::Closed), + )); + } } window::Action::GetOldest(channel) => { let id = |