orbital: Handle window closes during app drop

This commit is contained in:
bjorn3
2026-08-08 19:23:16 +02:00
committed by Jeremy Soller
parent 4e6525b4b7
commit 332224c92f
2 changed files with 15 additions and 1 deletions

View File

@@ -527,7 +527,7 @@ impl EventLoop {
mut app: A,
) -> Result<(), EventLoopError> {
self.window_target.exit.set(false);
loop {
let res = loop {
match self.pump_app_events(None, &mut app) {
PumpStatus::Exit(0) => {
break Ok(());
@@ -539,7 +539,20 @@ impl EventLoop {
continue;
},
}
};
drop(app);
// Handle window destroys that happened when dropping the app.
while let Some(destroy_id) = {
let mut destroys = self.window_target.destroys.lock().unwrap();
destroys.pop_front()
} {
self.windows
.retain(|(window, _event_state)| WindowId::from_raw(window.fd()) != destroy_id);
}
res
}
fn single_iteration<A: ApplicationHandler>(&mut self, app: &mut A, cause: StartCause) {

View File

@@ -112,3 +112,4 @@ changelog entry.
- On macOS, fix a panic and incorrect cursor position in Ime::Preedit when the preedit string contains special characters (ie. emojis) caused by incorrect UTF-16 to UTF-8 offset conversion.
- On Wayland, fix a protocol error when setting a custom cursor on compositors with `wl_surface` version below 3.
- On Redox, fix `run_app_on_demand` exiting immediately after a previous `run_app_on_demand` called `exit`.
- On Redox, handle window closes during `ApplicationHandler` drop.