#2829 Add overall handling of std::bad_alloc exception with a message box. Now the user can know what is happening, and possibly save his work. On linux this will only work sometimes unless sysctl vm.overcommit_memory = 2

This commit is contained in:
Jacob Støren
2018-05-03 09:53:54 +02:00
parent 92fd4183a9
commit 2f80e99abc
3 changed files with 52 additions and 1 deletions

View File

@@ -49,7 +49,22 @@ int main(int argc, char *argv[])
RiaLogging::setLoggerInstance(new RiuMessagePanelLogger(window.messagePanel()));
RiaLogging::loggerInstance()->setLevel(RI_LL_DEBUG);
int exitCode = app.exec();
int exitCode = 0;
try
{
exitCode = app.exec();
}
catch (std::exception& exep )
{
std::cout << "A standard c++ exception that terminated ResInsight caught in RiaMain.cpp: " << exep.what() << std::endl;
throw;
}
catch(...)
{
std::cout << "An unknown exception that terminated ResInsight caught in RiaMain.cpp. " << std::endl;
throw;
}
RiaLogging::deleteLoggerInstance();
return exitCode;