aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickview_p.h
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2020-05-20 14:37:12 +0200
committerUlf Hermann <ulf.hermann@qt.io>2020-05-20 22:43:25 +0200
commita64ee3a2481499f856d0f3fbc697399e0df1e8f8 (patch)
treebd4994eb797afe3f3dca66670cf72bf0da89d590 /src/quick/items/qquickview_p.h
parent542fdc075ebc7853869b285d6ac8fd75bfd2aafd (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 <shawn.rutledge@qt.io>
Diffstat (limited to 'src/quick/items/qquickview_p.h')
-rw-r--r--src/quick/items/qquickview_p.h2
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);