Fix crash in QQmlDelegateModel
authorAlbert Astals Cid <albert.astals@canonical.com>
Tue, 30 Apr 2013 21:03:03 +0000 (14:03 -0700)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Fri, 3 May 2013 17:11:18 +0000 (19:11 +0200)
commit9d6cd72353e4862592c016951810abf9a7ab8079
tree76cf626c81756ff5e11694b2b636b7d8f67c765b
parente1a8762e9c39133cb3d1d9c2cdf51003f75d6c05
Fix crash in QQmlDelegateModel

It can happen that when the QQmlDelegateModel goes away some of the
QQmlDelegateModelItem from d->m_cache are still incubating, this
means that isReferenced() will return true and we will not delete them.

This also means that when these QQDMIncubationTask finish they may end
up calling QQDMIncubationTask::statusChanged which will try to access
the delegate model that is already gone.

This commit makes sure we set vdm to 0 in these orphaned
QQDMIncubationTask so  in QQDMIncubationTask::statusChanged we know
no one cares about us anymore and don't reference the already gone
delegate model

Task-number:  QTBUG-30928

Change-Id: Ief6176cec151d861dad09ca2498ca27e17ee6385
Reviewed-by: Andrew den Exter <andrew.den.exter@qinetic.com.au>
src/qml/types/qqmldelegatemodel.cpp