Eliminate QSystemLocaleSingleton and QSystemLocale(bool)
They are no longer needed. The global static will only ever be instantiated if and when the QSystemLocale stack is empty; it will then survive to the end of run-time, serving as a bottom-of-stack instance that will always be fallen back to after any other instances' lifetimes. It can thus be a local static of the only function that accesses it. Change-Id: I21a1623728b25b46da6e25db9bb973c507a39ca3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
parent
6a14ad4993
commit
21d4e3a69d
@ -60,13 +60,6 @@ using namespace Qt::StringLiterals;
|
|||||||
|
|
||||||
#ifndef QT_NO_SYSTEMLOCALE
|
#ifndef QT_NO_SYSTEMLOCALE
|
||||||
Q_CONSTINIT static QSystemLocale *_systemLocale = nullptr;
|
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 = {};
|
Q_CONSTINIT static QLocaleData systemLocaleData = {};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -721,12 +714,6 @@ QSystemLocale::QSystemLocale() : next(_systemLocale)
|
|||||||
systemLocaleData.m_language_id = 0;
|
systemLocaleData.m_language_id = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
\internal
|
|
||||||
*/
|
|
||||||
QSystemLocale::QSystemLocale(bool)
|
|
||||||
{ }
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\internal
|
\internal
|
||||||
Deletes the object.
|
Deletes the object.
|
||||||
@ -750,7 +737,12 @@ static const QSystemLocale *systemLocale()
|
|||||||
{
|
{
|
||||||
if (_systemLocale)
|
if (_systemLocale)
|
||||||
return _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()
|
static void updateSystemPrivate()
|
||||||
|
@ -103,9 +103,6 @@ public:
|
|||||||
|
|
||||||
virtual QLocale fallbackLocale() const;
|
virtual QLocale fallbackLocale() const;
|
||||||
inline qsizetype fallbackLocaleIndex() const;
|
inline qsizetype fallbackLocaleIndex() const;
|
||||||
private:
|
|
||||||
QSystemLocale(bool);
|
|
||||||
friend class QSystemLocaleSingleton;
|
|
||||||
};
|
};
|
||||||
Q_DECLARE_TYPEINFO(QSystemLocale::QueryType, Q_PRIMITIVE_TYPE);
|
Q_DECLARE_TYPEINFO(QSystemLocale::QueryType, Q_PRIMITIVE_TYPE);
|
||||||
Q_DECLARE_TYPEINFO(QSystemLocale::CurrencyToStringArgument, Q_RELOCATABLE_TYPE);
|
Q_DECLARE_TYPEINFO(QSystemLocale::CurrencyToStringArgument, Q_RELOCATABLE_TYPE);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user