Skip to content
Snippets Groups Projects

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

Merged Wuttke, Joachim requested to merge i496j into r20.0
All threads resolved!

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 Wuttke, Joachim

Merge request reports

Pipeline #93801 passed

Pipeline passed for ac95af06 on i496j

Approval is optional

Merged by Wuttke, JoachimWuttke, Joachim 2 years ago (Mar 24, 2023 4:18pm UTC)

Merge details

  • Changes merged into r20.0 with ce832e20.
  • Deleted the source branch.
  • Auto-merge enabled

Pipeline #93802 passed

Pipeline passed for ce832e20 on r20.0

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
Please register or sign in to reply
Loading