Fix crash in QObject tree destruction

This issue was discovered while running the QtQuick Controls auto-tests
in valgrind. The issue is that the QObject based property in the VME meta
object is deleted as a child, after its parent (that had the property)
was deleted. At that point it's not safe anymore to emit the notify signal
in the already-deleted object (m_target->object).

Change-Id: I54e81dfedb6e712b8cbf182a72254e33e82910e3
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
This commit is contained in:
Simon Hausmann 2013-10-31 09:32:06 +01:00 committed by The Qt Project
parent 2c750b4570
commit bb7d26ebb0
1 changed files with 2 additions and 1 deletions

View File

@ -82,7 +82,8 @@ void QQmlVMEVariantQObjectPtr::objectDestroyed(QObject *)
}
}
m_target->activate(m_target->object, m_target->methodOffset() + m_index, 0);
if (!QQmlData::wasDeleted(m_target->object))
m_target->activate(m_target->object, m_target->methodOffset() + m_index, 0);
}
}