1
0
Fork 0

Explicit fatal error for bad_alloc

Give the user some feedback if we're exiting due to out-of-
memory condition.
This commit is contained in:
James Turner 2021-07-28 13:47:15 +01:00
parent e72f8e0286
commit ce237e4a74

View file

@ -337,6 +337,9 @@ int main ( int argc, char **argv )
info = std::string("received from ") + t.getOrigin(); info = std::string("received from ") + t.getOrigin();
flightgear::fatalMessageBoxWithoutExit( flightgear::fatalMessageBoxWithoutExit(
"Fatal exception", t.getFormattedMessage(), info); "Fatal exception", t.getFormattedMessage(), info);
} catch (const std::bad_alloc&) {
flightgear::fatalMessageBoxWithoutExit("Out of memory",
"FlightGear ran out of memory and must exit.", "Consider adjusting your settings or closing other applications.");
} catch (const std::exception &e ) { } catch (const std::exception &e ) {
flightgear::fatalMessageBoxWithoutExit("Fatal exception", e.what()); flightgear::fatalMessageBoxWithoutExit("Fatal exception", e.what());
} catch (const std::string &s) { } catch (const std::string &s) {