Skip to content

Commit

Permalink
Produce window::Event::Closed only if window exists
Browse files Browse the repository at this point in the history
  • Loading branch information
hecrj committed Aug 15, 2024
1 parent 7c2abc9 commit 9b99b93
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions winit/src/program.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down

0 comments on commit 9b99b93

Please sign in to comment.