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

Re-initializing QApplication causes QWebEngineView to crash

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P1: Critical
    • None
    • 6.5.6, 6.7.2, 6.8.0 Beta3
    • WebEngine
    • Windows 10 22H2, MSVC 2022 x64

    Description

      The symptoms are superficially similar to QTBUG-103611

       

      Steps to reproduce

      Run the attached project and close the window each time it appears.

      #include <QApplication>
      #include <QWebEngineView>
      
      int main()
      {
          for (int i = 1; i <= 3; ++i)
          {
              qDebug() << "Launching Qt app, repetition" << i;
      
              int argc = 1;
              QByteArray argv0("Window");
              QVector<char*> argv{argv0.data()};
      
              QApplication app(argc, argv.data());
              QWebEngineView view;
      
              qDebug("About to load URL...");
              view.load(QUrl("chrome://gpu")); // Crashes on the 2nd iteration
              qDebug("...URL loaded");
      
              view.show();
      
              app.exec();
              qDebug("Window closed");
          }
      }
      
      

       

      Result
      QWebEngineView::load() crashes on the 2nd interation.

      Here is an example stack trace from similar code from the customer:

      Thread 1 "webview" received signal SIGSEGV, Segmentation fault.
      (gdb) where
      #0 0x00007fffee3f22d0 in QtWebEngineCore::ProfileAdapter::userResourceController() ()
      from ../qt/lib/libQt6WebEngineCore.so.6
      #1 0x00007ffff193c90a in QWebEnginePagePrivate::QWebEnginePagePrivate(QWebEngineProfile*) ()
      from ../qt/lib/libQt6WebEngineCore.so.6
      #2 0x00007ffff193d785 in QWebEnginePage::QWebEnginePage(QObject*) ()
      from ../qt/lib/libQt6WebEngineCore.so.6
      #3 0x00007ffff7fe4feb in QWebEngineView::page() const ()
      from ../qt/lib/libQt6WebEngineWidgets.so.6
      #4 0x00007ffff7fe51b1 in QWebEngineView::load(QUrl const&) ()
      from ../qt/lib/libQt6WebEngineWidgets.so.6
      #5 0x0000000000402981 in main (argc=1, argv=0x7fffffffcb88) at main.cxx:54
      

       

      Use-case
      Unloading and reloading QApplication is typically done when Qt is used to implement a plugin for a larger non-Qt application

       

      Notes
      The crash does not occur if the QApplication constructor is moved outside the for-loop (so it is never destroyed in the loop). However, this is not always feasible.

      Attachments

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

        Activity

          People

            qt_webengine_team Qt WebEngine Team
            skoh-qt Sze Howe Koh
            Votes:
            1 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes