From f2bb6e235cc5d5654d89bb4543dd2b19c810bfaa Mon Sep 17 00:00:00 2001 From: Chance Date: Fri, 18 Apr 2025 14:06:38 -0400 Subject: [PATCH] fix(android): properly destroy windows on suspend --- src/main.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main.rs b/src/main.rs index 3a0f237..b5a3f60 100644 --- a/src/main.rs +++ b/src/main.rs @@ -493,6 +493,9 @@ impl ApplicationHandler for App<'_> { self.windows.insert(window_id, window_ctx); } } + fn suspended(&mut self, _event_loop: &ActiveEventLoop) { + self.windows.clear(); + } } pub fn main() -> Result<(), terminator::Terminator> { let config = LoggerConfig::default() @@ -507,6 +510,10 @@ pub fn main() -> Result<(), terminator::Terminator> { { _main() } + #[cfg(target_os = "android")] + { + Ok(()) + } } pub fn run_app(event_loop: winit::event_loop::EventLoop<()>) -> Result<(), terminator::Terminator> { let mut app = App::new();