diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index fd2337298..6ec8a20c4 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -951,23 +951,26 @@ static void generic_exception_handle() } catch (const std::bad_alloc& ex) { // bad_alloc in main thread is most likely fatal. Report immediately to the user (wxLogError would be delayed) // and terminate the app so it is at least certain to happen now. + BOOST_LOG_TRIVIAL(error) << boost::format("std::bad_alloc exception: %1%") % ex.what(); + flush_logs(); wxString errmsg = wxString::Format(_L("BambuStudio will terminate because of running out of memory." "It may be a bug. It will be appreciated if you report the issue to our team.")); wxMessageBox(errmsg + "\n\n" + wxString(ex.what()), _L("Fatal error"), wxOK | wxICON_ERROR); - BOOST_LOG_TRIVIAL(error) << boost::format("std::bad_alloc exception: %1%") % ex.what(); std::terminate(); //throw; } catch (const boost::io::bad_format_string& ex) { + BOOST_LOG_TRIVIAL(error) << boost::format("Uncaught exception: %1%") % ex.what(); + flush_logs(); wxString errmsg = _L("BambuStudio will terminate because of a localization error. " "It will be appreciated if you report the specific scenario this issue happened."); wxMessageBox(errmsg + "\n\n" + wxString(ex.what()), _L("Critical error"), wxOK | wxICON_ERROR); - BOOST_LOG_TRIVIAL(error) << boost::format("Uncaught exception: %1%") % ex.what(); std::terminate(); //throw; } catch (const std::exception& ex) { wxLogError(format_wxstr(_L("BambuStudio got an unhandled exception: %1%"), ex.what())); BOOST_LOG_TRIVIAL(error) << boost::format("Uncaught exception: %1%") % ex.what(); + flush_logs(); throw; } //#endif