diff --git a/apps/soundcraft/src/main.rs b/apps/soundcraft/src/main.rs index c38ea6b..295b1dd 100644 --- a/apps/soundcraft/src/main.rs +++ b/apps/soundcraft/src/main.rs @@ -39,6 +39,10 @@ impl eframe::App for App { } fn on_exit(&mut self) { save_prefs(&self.0.ui); + // The system Quit (⌘Q) ends the process from inside the event loop, so `run_native` never + // returns: release the player's plugin instances and shut plugin hosting down here. + self.0.player = None; + soundcraft_engine::shutdown_plugin_hosts(); } } @@ -168,7 +172,7 @@ fn main() -> eframe::Result { if let Some(icon) = app_icon() { options.viewport = options.viewport.with_icon(icon); } - let result = eframe::run_native( + eframe::run_native( "SoundCraft", options, Box::new(move |cc| { @@ -188,8 +192,5 @@ fn main() -> eframe::Result { } Ok(Box::new(App(app))) }), - ); - // The app, its player and their plugin instances are gone once the event loop returns. - soundcraft_engine::shutdown_plugin_hosts(); - result + ) }