diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2018-07-04 14:50:49 +0200 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2018-09-11 08:22:59 +0000 |
commit | d5891036de4622e18cf4d68750610224ad201ee0 (patch) | |
tree | e829a4833c35213f6ac603008023adcdcbe5107a /tests/auto/corelib/tools/qlocale/tst_qlocale.cpp | |
parent | 5d92f1793aa8438ea974cc2232d2aa3b1b2b2472 (diff) |
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 <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/corelib/tools/qlocale/tst_qlocale.cpp')
-rw-r--r-- | tests/auto/corelib/tools/qlocale/tst_qlocale.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp index 4bfaf23d22..9364122593 100644 --- a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp +++ b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp @@ -1870,9 +1870,11 @@ static void setWinLocaleInfo(LCTYPE type, const QString &value) # define LOCALE_SSHORTTIME 0x00000079 #endif -class RestoreLocaleHelper { +class RestoreLocaleHelper +{ public: - RestoreLocaleHelper() { + RestoreLocaleHelper() + { m_decimal = getWinLocaleInfo(LOCALE_SDECIMAL); m_thousand = getWinLocaleInfo(LOCALE_STHOUSAND); m_sdate = getWinLocaleInfo(LOCALE_SSHORTDATE); @@ -1880,7 +1882,8 @@ public: m_time = getWinLocaleInfo(LOCALE_SSHORTTIME); } - ~RestoreLocaleHelper() { + ~RestoreLocaleHelper() + { // restore these, or the user will get a surprise setWinLocaleInfo(LOCALE_SDECIMAL, m_decimal); setWinLocaleInfo(LOCALE_STHOUSAND, m_thousand); @@ -1888,12 +1891,10 @@ public: setWinLocaleInfo(LOCALE_SLONGDATE, m_ldate); setWinLocaleInfo(LOCALE_SSHORTTIME, m_time); - // make sure QLocale::system() gets updated - QLocalePrivate::updateSystemPrivate(); + QSystemLocale dummy; // to provoke a refresh of the system locale } QString m_decimal, m_thousand, m_sdate, m_ldate, m_time; - }; void tst_QLocale::windowsDefaultLocale() @@ -1909,8 +1910,7 @@ void tst_QLocale::windowsDefaultLocale() const QString shortTimeFormat = QStringLiteral("h^m^s"); setWinLocaleInfo(LOCALE_SSHORTTIME, shortTimeFormat); - // make sure QLocale::system() gets updated - QLocalePrivate::updateSystemPrivate(); + QSystemLocale dummy; // to provoke a refresh of the system locale QLocale locale = QLocale::system(); // make sure we are seeing the system's format strings |