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

QCommandLineParser crashes when helpText/showHelp is called without a QCoreApplication

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P1: Critical
    • Resolution: Done
    • Affects Version/s: 5.15.1
    • Fix Version/s: None
    • Component/s: Core: Other
    • Labels:
      None
    • Platform/s:
      All
    • Commits:
      101581484bd278ce4a5f329ffb13c9e0b0e4c131 (qt/qtbase/dev)

      Description

      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.

        Attachments

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

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes