From cc1d15dc46ecdc661e9eb96e0a6c2bd3832d5c83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Tue, 27 Apr 2010 13:46:57 +0200 Subject: Fixed a QFontEngine leak for QFont objects used in threads. Only the QFontCache object for the main thread was cleared when the the application exited, or a thread was destroyed. This caused font engine references to hang around and never get deleted. Task-number: QTBUG-3976 Reviewed-by: Brad --- src/gui/text/qfont.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index a41b000..b349bcf 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -2612,10 +2612,8 @@ void QFontCache::cleanup() } QT_CATCH (const std::bad_alloc &) { // no cache - just ignore } - if (cache && cache->hasLocalData()) { - cache->localData()->clear(); + if (cache && cache->hasLocalData()) cache->setLocalData(0); - } } #endif // QT_NO_THREAD @@ -2627,6 +2625,7 @@ QFontCache::QFontCache() QFontCache::~QFontCache() { + clear(); { EngineDataCache::ConstIterator it = engineDataCache.constBegin(), end = engineDataCache.constEnd(); -- cgit v0.12