fix(android): properly destroy windows on suspend

This commit is contained in:
Chance 2025-04-18 14:06:38 -04:00 committed by BitSyndicate
parent e50409943c
commit cc3c82d412
Signed by: bitsyndicate
GPG key ID: 443E4198D6BBA6DE

View file

@ -493,6 +493,9 @@ impl ApplicationHandler for App<'_> {
self.windows.insert(window_id, window_ctx); self.windows.insert(window_id, window_ctx);
} }
} }
fn suspended(&mut self, _event_loop: &ActiveEventLoop) {
self.windows.clear();
}
} }
pub fn main() -> Result<(), terminator::Terminator> { pub fn main() -> Result<(), terminator::Terminator> {
let config = LoggerConfig::default() let config = LoggerConfig::default()
@ -507,6 +510,10 @@ pub fn main() -> Result<(), terminator::Terminator> {
{ {
_main() _main()
} }
#[cfg(target_os = "android")]
{
Ok(())
}
} }
pub fn run_app(event_loop: winit::event_loop::EventLoop<()>) -> Result<(), terminator::Terminator> { pub fn run_app(event_loop: winit::event_loop::EventLoop<()>) -> Result<(), terminator::Terminator> {
let mut app = App::new(); let mut app = App::new();