diff --git a/src/CrealityPrint.cpp b/src/CrealityPrint.cpp index 4e124b5c..8e86fe32 100644 --- a/src/CrealityPrint.cpp +++ b/src/CrealityPrint.cpp @@ -6709,6 +6709,11 @@ extern "C" { #ifdef USE_BREAKPAD static bool dumpCallback(const google_breakpad::MinidumpDescriptor& descriptor,void* context, bool succeeded) { printf("Dump path: %s\n", descriptor.path()); + // This runs from breakpad's signal handler. A C++ exception escaping here + // (e.g. boost::filesystem::rename throwing when the target dir is missing) + // unwinds out of the signal handler and double-faults into a second, harder + // crash. Keep every throwing operation below inside this guard. + try { if (succeeded) { boost::filesystem::path oldPath(descriptor.path()); std::string data_dir = Slic3r::data_dir(); @@ -6763,6 +6768,9 @@ static bool dumpCallback(const google_breakpad::MinidumpDescriptor& descriptor,v } else { BOOST_LOG_TRIVIAL(error) << "MiniDump failed: " << descriptor.path(); } + } catch (...) { + // Never let an exception escape the signal handler. + } return succeeded; } #endif diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index 29506e42..71050595 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -3832,7 +3832,18 @@ int GUI_App::OnExit() int result = wxApp::OnExit(); BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << " end"; boost::log::core::get()->flush(); +#ifdef __linux__ + // On Linux the GL/GTK context is already torn down by the time std::exit() drives + // the global/static destructors. Static GLModel instances then call + // GLModel::RenderData::release() -> glDeleteBuffers() into a dead context, which + // segfaults on shutdown (and breakpad's handler double-faults on top of it). + // All persistent state (AppConfig, presets) has already been saved during the + // window-close sequence and wxApp::OnExit() above, so skip the global-destructor + // teardown entirely and terminate immediately. + std::_Exit(0); +#else std::exit(0); +#endif return 0; }