From 7c12bb692bf77d65f9b44f72451abdac72ed3004 Mon Sep 17 00:00:00 2001 From: Luke Jones Date: Wed, 19 Apr 2023 01:08:17 +1200 Subject: [PATCH] eframe: add call to save_and_destroy in Exit event of run_return (#2895) `EventResult::Exit` is hit before `Event::LoopDestroyed` is, and due to possibly some order of operations or drops the window is never destroyed on Linux. Adding a call to `winit_app.save_and_destroy();` where `EventResult::Exit` is checked solves this. Closes #2892 Signed-off-by: Luke D. Jones --- crates/eframe/CHANGELOG.md | 1 + crates/eframe/src/native/run.rs | 1 + 2 files changed, 2 insertions(+) diff --git a/crates/eframe/CHANGELOG.md b/crates/eframe/CHANGELOG.md index a8c8d980..d50d6670 100644 --- a/crates/eframe/CHANGELOG.md +++ b/crates/eframe/CHANGELOG.md @@ -8,6 +8,7 @@ NOTE: [`egui-winit`](../egui-winit/CHANGELOG.md), [`egui_glium`](../egui_glium/C #### Desktop/Native: * Add `Frame::request_screenshot` and `Frame::screenshot` to communicate to the backend that a screenshot of the current frame should be exposed by `Frame` during `App::post_rendering` ([#2676](https://github.com/emilk/egui/pull/2676)). * Add `eframe::run_simple_native` - a simple API for simple apps ([#2453](https://github.com/emilk/egui/pull/2453)). +* Fix bug where the eframe window is never destroyed on Linux when using `run_and_return` ([#2892](https://github.com/emilk/egui/issues/2892)) #### Web: * Bug fix: modifiers keys getting stuck on alt-tab ([#2857](https://github.com/emilk/egui/pull/2857)). diff --git a/crates/eframe/src/native/run.rs b/crates/eframe/src/native/run.rs index c9a4ebaa..03dff4e7 100644 --- a/crates/eframe/src/native/run.rs +++ b/crates/eframe/src/native/run.rs @@ -190,6 +190,7 @@ fn run_and_return( } EventResult::Exit => { tracing::debug!("Asking to exit event loop…"); + winit_app.save_and_destroy(); *control_flow = ControlFlow::Exit; return; }