mirror of
https://github.com/rust-windowing/winit.git
synced 2026-08-29 04:40:04 -04:00
orbital: Handle window closes during app drop
This commit is contained in:
@@ -527,7 +527,7 @@ impl EventLoop {
|
|||||||
mut app: A,
|
mut app: A,
|
||||||
) -> Result<(), EventLoopError> {
|
) -> Result<(), EventLoopError> {
|
||||||
self.window_target.exit.set(false);
|
self.window_target.exit.set(false);
|
||||||
loop {
|
let res = loop {
|
||||||
match self.pump_app_events(None, &mut app) {
|
match self.pump_app_events(None, &mut app) {
|
||||||
PumpStatus::Exit(0) => {
|
PumpStatus::Exit(0) => {
|
||||||
break Ok(());
|
break Ok(());
|
||||||
@@ -539,7 +539,20 @@ impl EventLoop {
|
|||||||
continue;
|
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) {
|
fn single_iteration<A: ApplicationHandler>(&mut self, app: &mut A, cause: StartCause) {
|
||||||
|
|||||||
@@ -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 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 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, fix `run_app_on_demand` exiting immediately after a previous `run_app_on_demand` called `exit`.
|
||||||
|
- On Redox, handle window closes during `ApplicationHandler` drop.
|
||||||
|
|||||||
Reference in New Issue
Block a user