Prevent a crash when the item is deleted but not removed from cache
authorAndy Shaw <andy.shaw@digia.com>
Thu, 17 Apr 2014 08:24:35 +0000 (10:24 +0200)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Fri, 18 Apr 2014 05:39:17 +0000 (07:39 +0200)
If the item is not removed from the cache when it is deleted then the
cache can end up pointing to an invalid item which when accessed will
cause a crash.

Task-number: QTBUG-38430

[ChangeLog][QtQml] Prevent a crash when the item is deleted
but is not removed from the QQmlDelegateModel's cache.

Change-Id: I8cf76b014be62a432d909a3573231cec84a6d678
Reviewed-by: Alan Alpert <aalpert@blackberry.com>
src/qml/types/qqmldelegatemodel_p_p.h

index 32b1154d30b3dc9a625c6f6e511e0016ee8c3864..7da089c9b8499de179371ff8a7e66f28748b8f61 100644 (file)
@@ -144,7 +144,7 @@ public:
     QQmlDelegateModelItemMetaType * const metaType;
     QQmlContextData *contextData;
     QObject *object;
-    QQmlDelegateModelAttached *attached;
+    QPointer<QQmlDelegateModelAttached> attached;
     QQDMIncubationTask *incubationTask;
     int objectRef;
     int scriptRef;