Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-44529

QWindowsNativeImage qFatals too easily

    XMLWordPrintable

Details

    • Bug
    • Resolution: Incomplete
    • Not Evaluated
    • None
    • 5.4.0
    • QPA: Windows
    • None
    • Windows

    Description

      qt_message_fatal in qlogging.cpp contains the following code / severe design issue:
      #if (defined(Q_OS_UNIX) || defined(Q_CC_MINGW))
      abort(); // trap; generates core dump
      #else
      exit(1); // goodbye cruel world
      #endif
      This is triggered from inside Qt and crashes the application immediately, effectively losing all our application data. Qt should throw an exception instead and leave it up to the developer to handle the situation appropriately. It is not possible to save application data from an at_exit-handler, as the database which I need to save is locked while we are inside the GUI. Thus it is necessary to leave the stack frames and save the data from outside.
      We could actually restart a crashed GUI and still keep the application core running, if there wasn't a call to exit() or std::terminate().
      Only in case Qt is translated without exception handling, exit() would perhaps be a suitable replacement.
      Possible workarounds do not work: As it is not allowed to throw an exception from an exit-handler, I cannot inject throwing an exception myself. Installing a throwing message handler doesn't work either, as Qt call std::terminate() in this case.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            kleint Friedemann Kleint
            reorx Jens
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes