diff --git a/src/corelib/text/qlocale.cpp b/src/corelib/text/qlocale.cpp index fb21b24ada0..e8ef6901867 100644 --- a/src/corelib/text/qlocale.cpp +++ b/src/corelib/text/qlocale.cpp @@ -60,13 +60,6 @@ using namespace Qt::StringLiterals; #ifndef QT_NO_SYSTEMLOCALE Q_CONSTINIT static QSystemLocale *_systemLocale = nullptr; -class QSystemLocaleSingleton: public QSystemLocale -{ -public: - QSystemLocaleSingleton() : QSystemLocale(true) {} -}; - -Q_GLOBAL_STATIC(QSystemLocaleSingleton, QSystemLocale_globalSystemLocale) Q_CONSTINIT static QLocaleData systemLocaleData = {}; #endif @@ -721,12 +714,6 @@ QSystemLocale::QSystemLocale() : next(_systemLocale) systemLocaleData.m_language_id = 0; } -/*! - \internal -*/ -QSystemLocale::QSystemLocale(bool) -{ } - /*! \internal Deletes the object. @@ -750,7 +737,12 @@ static const QSystemLocale *systemLocale() { if (_systemLocale) return _systemLocale; - return QSystemLocale_globalSystemLocale(); + + // As this is only ever instantiated with _systemLocale null, it is + // necessarily the ->next-most in any chain that may subsequently develop; + // and it won't be destructed until exit()-time. + static QSystemLocale globalInstance; + return &globalInstance; } static void updateSystemPrivate() diff --git a/src/corelib/text/qlocale_p.h b/src/corelib/text/qlocale_p.h index fc3d221971e..b349cccc9f8 100644 --- a/src/corelib/text/qlocale_p.h +++ b/src/corelib/text/qlocale_p.h @@ -103,9 +103,6 @@ public: virtual QLocale fallbackLocale() const; inline qsizetype fallbackLocaleIndex() const; -private: - QSystemLocale(bool); - friend class QSystemLocaleSingleton; }; Q_DECLARE_TYPEINFO(QSystemLocale::QueryType, Q_PRIMITIVE_TYPE); Q_DECLARE_TYPEINFO(QSystemLocale::CurrencyToStringArgument, Q_RELOCATABLE_TYPE);