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

Incorrect command-line parsing if argc=0

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Do
    • P3: Somewhat important
    • None
    • 6.4.0, 6.5.0 Beta1
    • WebEngine
    • None
    • Windows 10 21H2 (64bit). Visual Studio 2022.
    • Windows
    • 614d6639b (dev), 2e9bd519a (6.5)

    Description

      I'm experiencing problems with QtWebEngine not detecting QTWEBENGINE_CHROMIUM_FLAGS parameters if QGuiApplication have been created with argc=0. Zero command-line arguments might sound kind of weird but ActiveQt does exactly that (see QTBUG-110158), which is what is triggering this problem.

      Steps to reproduce:

      • Open WebEngineQuick "minimal" sample
      • Modify main function to the following:
      int main(int argc, char *argv[])
      {
          // Run web engine in-proc (to avoid QtWebEngineProcess[d].exe)
          qputenv("QTWEBENGINE_CHROMIUM_FLAGS", "--single-process");
      
          QCoreApplication::setOrganizationName("QtExamples");
          QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
          QtWebEngineQuick::initialize();
      
          argc = 0; // pretend zero command-line arguments (to mimic ActiveQt)
          QGuiApplication app(argc, argv);
      
          QQmlApplicationEngine engine;
          engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
      
          return app.exec();
      }
      
      • Observe that two QtWebEngineProcess[d].exe processes are started in addiction to webengine-minimal-qml.exe, despite WebEngine being instructed to run in-process.

      Suggested fix

      Improve WebEngineContext::initCommandLine to better deal with situations where QCoreApplication::arguments() returns an empty list.

      Attachments

        Activity

          People

            qt_webengine_team Qt WebEngine Team
            forderud Fredrik Orderud
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: