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
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2020-05-21 00:22:19 +0000
commite7dbcc3f00b396ec57926e8cb899b2a5735dcd05 (patch)
tree1ea99940fa933ba2929fe8cd235bfc58bf465ba4 /src/quick/items/qquickview_p.h
parent74ce060778dbcd7401049d170db54cf64eb27cd2 (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 Change-Id: I79ed37d22d304bcc6d4e3c956b83a65fe157dfe0 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> (cherry picked from commit a64ee3a2481499f856d0f3fbc697399e0df1e8f8) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
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);