From d5891036de4622e18cf4d68750610224ad201ee0 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Wed, 4 Jul 2018 14:50:49 +0200 Subject: Make updateSystemPrivate() local to qlocale.cpp It's not thread-safe so should only be used within systemData()'s locked code. This eliminates the last callers of it by making it a local function of the compilation unit, exposing a method from QSystemLocale() to get round its use of private parts. Make the constructor for QSystemLocale only stomp its _systemLocale global if previously unset, but let instantiation still clear globalLocaleData.m_language_id, so that it can be used as a way to trigger an update to system locale data. Change-Id: I908dca9fd30bbf20f42321ab8f9094f2fa37b7b0 Reviewed-by: Thiago Macieira --- src/corelib/tools/qlocale_p.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/corelib/tools/qlocale_p.h') diff --git a/src/corelib/tools/qlocale_p.h b/src/corelib/tools/qlocale_p.h index f2e11499c8..f7dbb3a815 100644 --- a/src/corelib/tools/qlocale_p.h +++ b/src/corelib/tools/qlocale_p.h @@ -66,6 +66,7 @@ QT_BEGIN_NAMESPACE #ifndef QT_NO_SYSTEMLOCALE +struct QLocaleData; class Q_CORE_EXPORT QSystemLocale { public: @@ -126,6 +127,7 @@ public: virtual QVariant query(QueryType type, QVariant in) const; virtual QLocale fallbackUiLocale() const; + inline const QLocaleData *fallbackUiLocaleData() const; private: QSystemLocale(bool); friend class QSystemLocaleSingleton; @@ -364,8 +366,6 @@ public: QLocale::MeasurementSystem measurementSystem() const; - static void updateSystemPrivate(); - QString dateTimeToString(QStringView format, const QDateTime &datetime, const QDate &dateOnly, const QTime &timeOnly, const QLocale *q) const; @@ -375,6 +375,10 @@ public: QLocale::NumberOptions m_numberOptions; }; +#ifndef QT_NO_SYSTEMLOCALE +const QLocaleData *QSystemLocale::fallbackUiLocaleData() const { return fallbackUiLocale().d->m_data; } +#endif + template <> inline QLocalePrivate *QSharedDataPointer::clone() { -- cgit v1.2.3