diff options
author | Mitch Curtis <mitch.curtis@qt.io> | 2018-09-26 15:16:41 +0200 |
---|---|---|
committer | Mitch Curtis <mitch.curtis@qt.io> | 2018-10-04 08:16:11 +0000 |
commit | d56c193eb4ceb640611d66f22e1f26aae91cd7d1 (patch) | |
tree | def130c72a80e0b433cf0b5c8d0a4e64ccde18a8 /src/imports/controls/material/qquickmaterialstyle_p.h | |
parent | d923dd467c1aeb3e195a09949b04862084002f88 (diff) |
QQuickPopupPositioner: avoid adding duplicate item change listeners
The issue is that QQuickPopupPositioner::setParentItem() is called when
the delegate has been created and assigned to the Repeater, then the
ancestor listeners are added, and then straight after that, the
benchmark item itself is parented to benchmarkRoot, which causes
QQuickPopupPositioner::itemParentChanged() to be called, which adds a
single ancestor listener: the QQuickRootItem (which was just added
previously as a result of QQuickPopupPositioner::setParentItem()
being called).
The item could be arbitrarily high up in the ancestry tree, so there's
no nice (i.e. fast) way of checking for duplicates in Controls 2
itself. Instead, use the new
QQuickItemPrivate::updateOrAddItemChangeListener() function which only
adds the listener if it doesn't already exist.
This avoids a heap-use-after-free in qmlbench when creating Menus.
Task-number: QTBUG-70729
Change-Id: I0efaa10167c4c9a9c4c1b65a5c34e683c3ec5732
Fixes: QTBUG-70729
Reviewed-by: Michael Brasser <michael.brasser@live.com>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'src/imports/controls/material/qquickmaterialstyle_p.h')
0 files changed, 0 insertions, 0 deletions