Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/CrealityPrint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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
Expand Down
11 changes: 11 additions & 0 deletions src/slic3r/GUI/GUI_App.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down