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

QApplication::arguments() gives wrong result if QApplication is created in a static library

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • P1: Critical
    • None
    • 5.12
    • Core: Other
    • None
    • Qt 5.12.6, MSVC 2017, Win10 x64
    • Windows

    Description

      I have a static lib method which returns a QApplication pointer

      QApplication *Testlib::createApp(int argc, char *argv[]) {
          QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
          return new QApplication(argc, argv);
      }

      But it sometimes will crash when calling the arguments() method.

      int main(int argc, char *argv[]) {
      QApplication *a = Testlib::createApp(argc, argv);
      qDebug() << a->arguments() << argc;
      return 0;
      }

      Exception at 0x7ffcea35a839, code: 0xe06d7363: C++ exception, flags=0x1 (execution cannot be continued) (first chance) in Qt5Cored!QVariant::QVariant

      Exception at 0x7ffcea35a839, code: 0xe06d7363: C++ exception, flags=0x1 (execution cannot be continued) in Qt5Cored!QVariant::QVariant

      When it not crash, it gives an empty QStringList

      () 1

      I met this issue with x64 build only.
      If the pointer is created in main(), nothing goes wrong.
      If the Testlib::createApp returns a std::unique_ptr<QApplication>, everything works too.

      Attachments

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

        Activity

          People

            thiago Thiago Macieira
            xuzhen xuzhen
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes