Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.11.3
-
None
-
-
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
For Gerrit Dashboard: QTBUG-75175 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
258874,4 | Fix QWebEngineView::setPage not deleting old page | 5.12 | qt/qtwebengine | Status: MERGED | +2 | 0 |
259047,1 | Fix leaking of implicitly created Webengine pages | 5.12 | qt/qtwebengine | Status: ABANDONED | 0 | 0 |