1
0
Fork 0

Revert commit "Make fatalMessageBox() end with std::abort() [...]"

This reverts commit 9e6a3ebc6b ("Make
fatalMessageBox() end with std::abort() and declare it [[noreturn]]").

After reflexion, it seems better to let fatalMessageBox() return,
because there is existing code that appears to be relying on this aspect
to do some work after having called fatalMessageBox() (cf. main() in
bootstrap.cxx). Also, the way of exiting from fatalMessageBox() after
commit 9e6a3ebc6b (std::abort()) was probably too brutal for a
controlled exit---as opposed to a terminate handler.
This commit is contained in:
Florent Rougon 2017-04-09 17:49:06 +02:00
parent 09dd24c139
commit 680f940378
3 changed files with 10 additions and 11 deletions

View file

@ -148,16 +148,16 @@ MessageBoxResult modalMessageBox(const std::string& caption,
#endif
}
[[noreturn]] void fatalMessageBox(const std::string& caption,
MessageBoxResult fatalMessageBox(const std::string& caption,
const std::string& msg,
const std::string& moreText)
{
#if defined(SG_WINDOWS)
win32MessageBox(caption, msg, moreText);
return win32MessageBox(caption, msg, moreText);
#elif defined(SG_MAC)
cocoaFatalMessage(msg, moreText);
return cocoaFatalMessage(msg, moreText);
#elif defined(HAVE_QT)
QtMessageBox(caption, msg, moreText, true);
return QtMessageBox(caption, msg, moreText, true);
#else
std::string s = "FATAL: "+ msg;
if (!moreText.empty()) {
@ -171,9 +171,8 @@ MessageBoxResult modalMessageBox(const std::string& caption,
dlg->setStringValue("text/label", s );
_gui->showDialog("popup");
}
return MSG_BOX_OK;
#endif
std::abort();
}
} // of namespace flightgear

View file

@ -17,7 +17,7 @@ MessageBoxResult modalMessageBox(const std::string& caption,
const std::string& msg,
const std::string& moreText = std::string());
[[noreturn]] void fatalMessageBox(const std::string& caption,
MessageBoxResult fatalMessageBox(const std::string& caption,
const std::string& msg,
const std::string& moreText = std::string());

View file

@ -113,11 +113,11 @@ namespace flightgear
return MSG_BOX_OK;
}
[[noreturn]] void fatalMessageBox(const std::string& caption,
MessageBoxResult fatalMessageBox(const std::string& caption,
const std::string& msg,
const std::string& moreText)
{
std::abort();
return MSG_BOX_OK;
}
}