File tree 1 file changed +5
-5
lines changed
1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -168,11 +168,8 @@ fn change_window(
168
168
}
169
169
}
170
170
bevy_window:: WindowCommand :: Close => {
171
- let window = winit_windows. remove_window ( id) ;
172
- // Close the window
173
- drop ( window) ;
174
- // Since we borrow `windows` here to iterate through them, we can't mutate it here.
175
- // Add it to the queue to solve this
171
+ // Since we have borrowed `windows` to iterate through them, we can't remove the window from it.
172
+ // Add the removal requests to a queue to solve this
176
173
removed_windows. push ( id) ;
177
174
// No need to run any further commands - this drops the rest of the commands, although the `bevy_window::Window` will be dropped later anyway
178
175
break ;
@@ -182,6 +179,9 @@ fn change_window(
182
179
}
183
180
if !removed_windows. is_empty ( ) {
184
181
for id in removed_windows {
182
+ // Close the OS window. (The `Drop` impl actually closes the window)
183
+ let _ = winit_windows. remove_window ( id) ;
184
+ // Clean up our own data structures
185
185
windows. remove ( id) ;
186
186
window_close_events. send ( WindowClosed { id } ) ;
187
187
}
You can’t perform that action at this time.
0 commit comments