From c3cfb03dfe916f675b3c56e89c2dd6f1cd91652c Mon Sep 17 00:00:00 2001 From: Kris Austin Date: Tue, 6 Oct 2026 15:22:20 -0500 Subject: [PATCH] fix: crash on macOS when quitting from the Dock with the Bambu network plugin loaded (#16212) Co-authored-by: Ioannis Giannakas <59056762+igiannakas@users.noreply.github.com> --- src/slic3r/GUI/GUI_App.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index 62e780afef..2293a94d62 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -3112,8 +3112,11 @@ bool GUI_App::on_init_inner() // A quit request from the Dock, a logout or a restart ends with AppKit calling exit() right after this event, so // OnExit() and ~GUI_App() never run. Shut the plugins and Python down here as ~GUI_App() does. Left to // PluginManager's static destructor, the shutdown locks hook state that has already been destroyed and aborts. - wxGetApp().Bind(wxEVT_END_SESSION, [](wxCloseEvent &e) { + // Unload the Bambu network plugin too. Its static destructors abort if its agent's threads are still running. + wxGetApp().Bind(wxEVT_END_SESSION, [this](wxCloseEvent &e) { BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << "received wxEVT_END_SESSION"; + stop_sync_user_preset(); + Slic3r::NetworkAgent::unload_network_module(); Slic3r::PluginManager::instance().shutdown(); Slic3r::PythonInterpreter::instance().shutdown(); e.Skip();