diff options
author | Ulf Hermann <[email protected]> | 2020-05-20 14:37:12 +0200 |
---|---|---|
committer | Ulf Hermann <[email protected]> | 2020-05-20 22:43:25 +0200 |
commit | a64ee3a2481499f856d0f3fbc697399e0df1e8f8 (patch) | |
tree | bd4994eb797afe3f3dca66670cf72bf0da89d590 /src/quick/items/qquickview_p.h | |
parent | 542fdc075ebc7853869b285d6ac8fd75bfd2aafd (diff) |
Fix handling of QQuickViewPrivate::root
QQuickView is supposed to own the root item and shall also track it for
external deletion. Therefore, when we assign a new root item we need to
delete the old one. There is no point in setting a QPointer to nullptr
after deleting it. It will do that by itself. When we fail to assign a
new item, we should _not_ automatically delete the new one. Calling code
typically does not expect the argument to a set* call to be deleted
right away. Rather, return a boolean indicating whether we have
successfully set the root object. This can then be used to get rid of
the object if necessary.
Coverity-Id: 218729
Pick-to: 5.15
Pick-to: 5.12
Change-Id: I79ed37d22d304bcc6d4e3c956b83a65fe157dfe0
Reviewed-by: Shawn Rutledge <[email protected]>
Diffstat (limited to 'src/quick/items/qquickview_p.h')
-rw-r--r-- | src/quick/items/qquickview_p.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/quick/items/qquickview_p.h b/src/quick/items/qquickview_p.h index b1ab8d8e8c..1bc266bbbf 100644 --- a/src/quick/items/qquickview_p.h +++ b/src/quick/items/qquickview_p.h @@ -91,7 +91,7 @@ public: void itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, const QRectF &) override; void initResize(); void updateSize(); - void setRootObject(QObject *); + bool setRootObject(QObject *); void init(QQmlEngine* e = nullptr); |