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

QCommandLineParser crashes when helpText/showHelp is called without a QCoreApplication

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P1: Critical P1: Critical
    • None
    • 5.15.1
    • Core: Other
    • None
    • All
    • 101581484bd278ce4a5f329ffb13c9e0b0e4c131 (qt/qtbase/dev)

      The QCommandLineParser class seems to have a strange relation to QCoreApplication. It provides an interface, through which the command line parameters can be parsed, which makes it possible to use it BEFORE a QCoreApplication is created. However calling one of the helpText/showHelp function crashes the application, since an array emptiness check is missing at the line:

       

      https://code.woboq.org/qt5/qtbase/src/corelib/tools/qcommandlineparser.cpp.html#1126

       

      which brings us to the question: if I provide every information about command line argument parsing for an object of this class, why is the QCoreApplication needed? Isn't everything already stored in the QCommandLineParser object itself? Is it not possible to only print the QCoreApplication-dependent information optionally, if the QCoreApplication exists?

       

      Anyway, at least returning an empty string an setting the error accordingly is expected instead of crashing.

        For Gerrit Dashboard: QTBUG-91430
        # Subject Branch Project Status CR V

            dfaure_kdab David Faure
            tamas_szep Tamas Szep
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes