diff options
author | Laszlo Agocs <laszlo.p.agocs@nokia.com> | 2012-01-29 17:14:48 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-02-02 17:27:12 +0100 |
commit | fd39d7eeec32fb29541decc11115608f9b759c86 (patch) | |
tree | bcead2bd2dd5e8a665dc81d84c2dd1624c00e86c /src | |
parent | 4ab22fd809a43a57bf401e68282b697d5e5fd008 (diff) |
Do not start timers in QDeclarativePixmapStore teardown
The store instance is a global static and so starting timers
during its destruction is unnecessary, and may cause crashes
if the QAbstractEventDispatcher's statics are already destroyed.
This happens on OS X at least.
Change-Id: I785515c8973b291a7bfc6c5dabe2c19e8393c7ad
Reviewed-by: Martin Jones <martin.jones@nokia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/quick/util/qdeclarativepixmapcache.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/quick/util/qdeclarativepixmapcache.cpp b/src/quick/util/qdeclarativepixmapcache.cpp index 15a46375da..6460136775 100644 --- a/src/quick/util/qdeclarativepixmapcache.cpp +++ b/src/quick/util/qdeclarativepixmapcache.cpp @@ -707,17 +707,20 @@ private: int m_unreferencedCost; int m_timerId; + bool m_destroying; }; Q_GLOBAL_STATIC(QDeclarativePixmapStore, pixmapStore); QDeclarativePixmapStore::QDeclarativePixmapStore() -: m_unreferencedPixmaps(0), m_lastUnreferencedPixmap(0), m_unreferencedCost(0), m_timerId(-1) + : m_unreferencedPixmaps(0), m_lastUnreferencedPixmap(0), m_unreferencedCost(0), m_timerId(-1), m_destroying(false) { } QDeclarativePixmapStore::~QDeclarativePixmapStore() { + m_destroying = true; + int leakedPixmaps = 0; QList<QDeclarativePixmapData*> cachedData = m_cache.values(); @@ -764,7 +767,7 @@ void QDeclarativePixmapStore::unreferencePixmap(QDeclarativePixmapData *data) shrinkCache(-1); // Shrink the cache incase it has become larger than cache_limit - if (m_timerId == -1 && m_unreferencedPixmaps) + if (m_timerId == -1 && m_unreferencedPixmaps && !m_destroying) m_timerId = startTimer(CACHE_EXPIRE_TIME * 1000); } |