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

Crash when deleting a QWebEnginePage owned by a QWebEngineView derived widget

    XMLWordPrintable

Details

    • Linux/X11
    • 96fb3a30457c8925431b67c0f35abb2833b7fb7c (qt/qtwebengine/5.12)

    Description

      In Qt 5.11 (but apparently not Qt 5.12), QWebEngineView appears to consider QWebEnginePage objects that children (in QObject sense) of the QWebEngineView to be destructed on unbinding. While this is a good idea for QWebEnginePage objects created by QWebEngineView, it leads to early destruction by externally created QWebEnginePage object.

      The attachment is a minimal example to point out the problem. As far as I understand the Qt object lifetime management, the example is supposed to not crash, because deleting a child object while the parent is alive is generally allowed (and just removes the child gracefully). I am well aware of the deletion being pointless in this case (and thus removing the deletion is a valid fix for this example).

      In the example, delete m_page invokes the destructor of QWebEnignePage which uses QWebEngineViewPrivate::bind to unbind the page under deletion from the QWebEngineView. The bind function finds out that the parent of the QWebEnginePage is the view we are currently unbinding from, and proceeds with deleting the page already under deletion.

      Attachments

        1. qwebtest.cpp
          0.4 kB
        2. qwebtest.pro
          0.1 kB
        For Gerrit Dashboard: QTBUG-75175
        # Subject Branch Project Status CR V

        Activity

          People

            allan.jensen Allan Sandfeld Jensen
            mkarcher Michael Karcher
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes