Don't start timers in the QDeclarativePixmapStore destructor
authorTor Arne Vestbø <tor.arne.vestbo@nokia.com>
Fri, 3 Feb 2012 13:11:27 +0000 (14:11 +0100)
committerQt by Nokia <qt-info@nokia.com>
Mon, 6 Feb 2012 11:21:14 +0000 (12:21 +0100)
Timers use global static data, which might have been torn down at the
point where we start the timer.

Change-Id: Id11de05ae92b9a3652f9b1d7c3d5ca4947ffe065
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
Reviewed-by: Simon Hausmann <simon.hausmann@nokia.com>
Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>

src/quick/util/qdeclarativepixmapcache.cpp

index 6460136..8035923 100644 (file)
@@ -724,6 +724,11 @@ QDeclarativePixmapStore::~QDeclarativePixmapStore()
     int leakedPixmaps = 0;
     QList<QDeclarativePixmapData*> cachedData = m_cache.values();
 
+    // Prevent unreferencePixmap() from assuming it needs to kick
+    // off the cache expiry timer, as we're shrinking the cache
+    // manually below after releasing all the pixmaps.
+    m_timerId = -2;
+
     // unreference all (leaked) pixmaps
     foreach (QDeclarativePixmapData* pixmap, cachedData) {
         int currRefCount = pixmap->refCount;