aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@qt.io>2017-06-27 15:01:44 +0200
committerSimon Hausmann <simon.hausmann@qt.io>2017-07-27 12:37:11 +0000
commit7ed7f10b9e3a345b6125602910b02afd7fdeb026 (patch)
tree18fe480faead8c25dd6df0fdc1ae12b303775470 /src
parentbd5345637453697269bb20bd8d25128432ea8265 (diff)
Fix bug in designer support reference counting
The QtQuick designer support may override the meta-object and reparent the property-cache of the object under editing. The code for replacing the parent of the property cache however was not handling the refcount of the _parent correctly. Change-Id: Ic73294fc208b297e8ec9c0b775b5da01a309dba6 Reviewed-by: Robin Burchell <robin.burchell@viroteck.net> (cherry picked from commit 7dc5cd942eb5c55a26d539eedff48b2d6c8e0fc3) Reviewed-by: Robin Burchell <robin.burchell@crimson.no>
Diffstat (limited to 'src')
-rw-r--r--src/qml/qml/qqmlpropertycache.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/qml/qml/qqmlpropertycache.cpp b/src/qml/qml/qqmlpropertycache.cpp
index be730c7ac9..ff43e80649 100644
--- a/src/qml/qml/qqmlpropertycache.cpp
+++ b/src/qml/qml/qqmlpropertycache.cpp
@@ -449,7 +449,12 @@ QQmlPropertyCache *QQmlPropertyCache::parent() const
void QQmlPropertyCache::setParent(QQmlPropertyCache *newParent)
{
+ if (_parent == newParent)
+ return;
+ if (_parent)
+ _parent->release();
_parent = newParent;
+ _parent->addref();
}
// Returns the first C++ type's QMetaObject - that is, the first QMetaObject not created by