Always call ~QObjectWrapper() to the wrapper object in
QObjectWrapper::destroy(), otherwise the m_object member of QObjectWrapper
may still hold a QtSharedPointer::ExternalRefCountData object which will
never been deleted.
I don't know why this will not cause leak in the past, but it seems that
the leak was introduced in
7ae796cb141b73a1b215b2b0fd64b7ffbbd1e510
Change-Id: I24b49bb11f95b7e3060c7adba1ab80b615da2942
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
void QObjectWrapper::destroy(Managed *that)
{
QObjectWrapper *This = static_cast<QObjectWrapper*>(that);
- QPointer<QObject> &object = This->m_object;
+ QPointer<QObject> object = This->m_object;
+ ExecutionEngine *engine = This->engine();
+ This->~QObjectWrapper();
+ This = 0;
if (!object)
return;
return;
QObjectDeleter *deleter = new QObjectDeleter(object);
- This->engine()->memoryManager->registerDeletable(deleter);
-
- This->~QObjectWrapper();
+ engine->memoryManager->registerDeletable(deleter);
}