From addffb71b45b5123ee449f0cfa4891dcab044a9f Mon Sep 17 00:00:00 2001 From: Jian Liang Date: Sat, 14 Apr 2012 15:50:58 +0800 Subject: [PATCH] Fix memory leak of QFontEngineData Move QFont::cleanup(); and cleanupThreadData(); to the end of destructor of QGuiApplicationPrivate class. This is because they will trigger the QFontCache::~QFontCache() function being called and at that time the platform_theme object still hold some fonts object, This will cause the QFontEngineData object hold by those fonts can never been deleted. Change-Id: I4d3f21c5e2683706f68395ba3ad24203081e1d1d Reviewed-by: Jiang Jiang Reviewed-by: Lars Knoll Reviewed-by: Bradley T. Hughes Reviewed-by: Friedemann Kleint Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/gui/kernel/qguiapplication.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index f7675f5267..e1ab64bc33 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -875,16 +875,12 @@ QGuiApplicationPrivate::~QGuiApplicationPrivate() clearFontUnlocked(); - QFont::cleanup(); - #ifndef QT_NO_CURSOR QCursorData::cleanup(); #endif layout_direction = Qt::LeftToRight; - cleanupThreadData(); - delete styleHints; delete inputMethod; @@ -896,6 +892,10 @@ QGuiApplicationPrivate::~QGuiApplicationPrivate() delete platform_integration; platform_integration = 0; delete m_gammaTables.load(); + + QFont::cleanup(); + + cleanupThreadData(); } #if 0