From 7dc5cd942eb5c55a26d539eedff48b2d6c8e0fc3 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Mon, 30 May 2016 16:08:53 +0200 Subject: 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 --- src/qml/qml/qqmlpropertycache.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/qml/qml/qqmlpropertycache.cpp') 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 -- cgit v1.2.3