Failed assertion throws runtime_error; message box moved to GUI main loop try..catch wrapper (#496)

Failed assertions were not properly handled in extant code. We launched a QMessageBox from a thread, which is unsafe according to the Qt docs, and actually failed (it could be repaired by shortening the error message, e.g. by ommitting the file name, but that would be quite fragile a solution).

Now, a failed assertion just throws a std::runtime_error. We don't use qFatal any longer. This allows us to remove the failedAssert function pointer and the QMessageHandler.

If catched inside the GUI, the failed assertion is displayed in the message frame. Otherwise, the exception is catched in the main program, which launches a QMessageBox within a fresh QApplication.

This leaves one specific case uncovered, namely: Failed assertions (and other exceptions) thrown in event handlers but outside specific try blocks.

Edited by Joachim Wuttke

Merge request reports

Loading