forked from qt-creator/qt-creator
Fix assert for m_objectInstanceHash
The hash was not cleaned up in any case and sometimes a new object gets allocated at the exact same address. To avoid leaking hashes in m_objectInstanceHash and to avoid the assert, we remove any deleted QObject from the hash. Change-Id: I2697ab2b2430ad47932841fb9c0ef88ffa4cbbb1 Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
This commit is contained in:
committed by
Thomas Hartmann
parent
54ce123a26
commit
a2aaf0f6eb
@@ -111,7 +111,15 @@ ObjectNodeInstance::ObjectNodeInstance(QObject *object)
|
||||
m_deleteHeldInstance(true),
|
||||
m_isInLayoutable(false)
|
||||
{
|
||||
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);
|
||||
});
|
||||
}
|
||||
|
||||
ObjectNodeInstance::~ObjectNodeInstance()
|
||||
|
||||
Reference in New Issue
Block a user