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>
This commit is contained in:
Simon Hausmann 2016-05-30 16:08:53 +02:00 committed by Simon Hausmann
parent 7cd4d60c74
commit 7dc5cd942e
1 changed files with 5 additions and 0 deletions

View File

@ -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