aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlpropertycache.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@theqtcompany.com>2016-05-30 16:08:53 +0200
committerSimon Hausmann <simon.hausmann@qt.io>2016-05-30 14:44:42 +0000
commit7dc5cd942eb5c55a26d539eedff48b2d6c8e0fc3 (patch)
tree3dc86c74088d84ce52ee0b893b9c196da2371739 /src/qml/qml/qqmlpropertycache.cpp
parent7cd4d60c74ed20abead1434fc0b020e46437575e (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>
Diffstat (limited to 'src/qml/qml/qqmlpropertycache.cpp')
-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 4ac13d1cb4..08d51ecfa1 100644
--- a/src/qml/qml/qqmlpropertycache.cpp
+++ b/src/qml/qml/qqmlpropertycache.cpp
@@ -452,7 +452,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