diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2016-08-19 16:30:18 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2016-08-23 13:08:56 +0000 |
commit | aad32ba922b900642e6e3db994d1aa55b24dc8c2 (patch) | |
tree | 035d89221848d1e9c78d14b5954370632d288daa | |
parent | 20c00be872220f547211b87a2d3d34e12bd0f3d8 (diff) |
Fix QQuickViewChangeListener
QQuickViewChangeListener wasn't cleaning up its ancestor listeners
properly. QQuickItemChangeListener::itemChildRemoved() is too late
for removing listeners of the _ancestors_ of the child that just
got removed.
Task-number: QTBUG-55127
Change-Id: I004a5dd0b49fa36baabf951ee41d8a9ccdef4da8
Reviewed-by: Christian Stromme <christian.stromme@qt.io>
-rw-r--r-- | src/webview/qquickviewcontroller.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/webview/qquickviewcontroller.cpp b/src/webview/qquickviewcontroller.cpp index 0295d1f..ab9e254 100644 --- a/src/webview/qquickviewcontroller.cpp +++ b/src/webview/qquickviewcontroller.cpp @@ -99,14 +99,14 @@ void QQuickViewChangeListener::itemChildRemoved(QQuickItem *item, QQuickItem *ch Q_UNUSED(item) Q_ASSERT(item != m_item); - const bool ancestor = isAncestor(child); + const bool remove = (child == m_item) || isAncestor(child); - // if the child isn't an ancestor of the view item, then we don't care. - if (!ancestor) + // if the child isn't the view item or its ancestor, then we don't care. + if (!remove) return; // Remove any listener we attached to the child and its ancestors. - removeAncestorListeners(child, changeMask); + removeAncestorListeners(item, changeMask); } void QQuickViewChangeListener::itemParentChanged(QQuickItem * /*item*/, QQuickItem *newParent) |