forked from qt-creator/qt-creator
QmlPuppet: Fix crash at puppet reset
Puppet cleanup was not handled properly, so derefFromEffectItem() was not called for all objects that needed it, causing puppet to crash at shutdown. Fixes: QDS-3461 Change-Id: I22c0552fe1223789fa42b276ab377d4a9e929955 Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -65,12 +65,7 @@ ObjectNodeInstance::ObjectNodeInstance(QObject *object)
|
||||
{
|
||||
if (object)
|
||||
QObject::connect(m_object.data(), &QObject::destroyed, [=] {
|
||||
|
||||
/*This lambda is save because m_nodeInstanceServer
|
||||
is a smartpointer and object is a dangling pointer anyway.*/
|
||||
|
||||
if (m_nodeInstanceServer)
|
||||
m_nodeInstanceServer->removeInstanceRelationsipForDeletedObject(object);
|
||||
handleObjectDeletion(object);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -100,6 +95,14 @@ void ObjectNodeInstance::destroy()
|
||||
m_instanceId = -1;
|
||||
}
|
||||
|
||||
void ObjectNodeInstance::handleObjectDeletion(QObject *object)
|
||||
{
|
||||
// We must pass the m_instanceId here, because this instance is no longer
|
||||
// valid, so the wrapper ServerNodeInstance will report -1 for id.
|
||||
if (m_nodeInstanceServer)
|
||||
m_nodeInstanceServer->removeInstanceRelationsipForDeletedObject(object, m_instanceId);
|
||||
}
|
||||
|
||||
void ObjectNodeInstance::setInstanceId(qint32 id)
|
||||
{
|
||||
m_instanceId = id;
|
||||
|
||||
Reference in New Issue
Block a user