From 7ed7f10b9e3a345b6125602910b02afd7fdeb026 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Tue, 27 Jun 2017 15:01:44 +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 (cherry picked from commit 7dc5cd942eb5c55a26d539eedff48b2d6c8e0fc3) Reviewed-by: Robin Burchell --- src/qml/qml/qqmlpropertycache.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') 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 -- cgit v1.2.3