From 91aaf4b1c653ec4f66b609eb5b189883120b7336 Mon Sep 17 00:00:00 2001 From: John Tapsell Date: Tue, 17 Aug 2010 02:19:56 +0900 Subject: Fixes: NB#180677 - Delete MLocale etc when MApplication is deleted RevBy: Ville Voutilainen --- src/corelib/i18n/mlocale.cpp | 5 +++++ src/corelib/i18n/mlocale.h | 2 ++ 2 files changed, 7 insertions(+) (limited to 'src/corelib/i18n') diff --git a/src/corelib/i18n/mlocale.cpp b/src/corelib/i18n/mlocale.cpp index 917b7064..5d687bf0 100644 --- a/src/corelib/i18n/mlocale.cpp +++ b/src/corelib/i18n/mlocale.cpp @@ -1117,6 +1117,11 @@ static QMutex defaultLocaleMutex; // The static default locale MLocale *MLocale::s_systemDefault = 0; +struct MStaticLocaleDestroyer { + ~MStaticLocaleDestroyer() { delete MLocale::s_systemDefault; MLocale::s_systemDefault = 0; } +}; +static MStaticLocaleDestroyer staticLocaleDestroyer; + void MLocale::setDefault(const MLocale &locale) { defaultLocaleMutex.lock(); diff --git a/src/corelib/i18n/mlocale.h b/src/corelib/i18n/mlocale.h index 48439607..f048ef16 100644 --- a/src/corelib/i18n/mlocale.h +++ b/src/corelib/i18n/mlocale.h @@ -35,6 +35,7 @@ class MCalendar; class MBreakIteratorPrivate; class MLocalePrivate; +class MStaticLocaleDestroyer; /*! * \class MLocale @@ -1332,6 +1333,7 @@ private: friend class MCalendar; friend class MCollator; + friend class MStaticLocaleDestroyer; friend class MIcuBreakIteratorPrivate; private Q_SLOTS: -- cgit v1.2.3