summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qlocale.cpp
diff options
context:
space:
mode:
authorAlbert Astals Cid <albert.astals.cid@kdab.com>2018-01-02 10:48:34 +0100
committerAlbert Astals Cid <albert.astals.cid@kdab.com>2018-03-02 09:52:14 +0000
commit78e92997ed35ddc8bb6f7f6c0a4fffba026d5d8f (patch)
tree664e5e4bfa78c1d07316a18a48e503c197048fc0 /src/corelib/tools/qlocale.cpp
parentfdddb3a4814f588e3ee87a6c1a0a6791f6ef0298 (diff)
QLocale: Update the system private on QLocale default constructor if needed
When first starting an Android app we have invocation order issue, to load the platform plugin we create the default QLocale (needed by the resource locator code to see if :/qt/etc/qt.conf exists) so when the android platform plugin loads and creates its own QSystemLocale, the QLocale defaultLocalePrivate is already created and pointing to globalLocaleData which means that systemData won't be called and thus the code that triggers the call to QLocalePrivate::updateSystemPrivate won't be called when calling QLocale(). I thought of two ways of fixing this, one was calling QLocalePrivate::updateSystemPrivatea() from the QAndroidSystemLocale constructor, but giving the responsibility to not break things to the plugin seems a little fragile, so making the check on QLocale() seems better. Without this patch an Android app doing QApplication app(argc, argv); qDebug() << QLocale().name(); qDebug() << QLocale().name(); qDebug() << QLocale::system().name(); qDebug() << QLocale().name(); would print "" "" "ca_ES" "ca_ES" now it correctly prints "ca_ES" the four times. Task-number: QTBUG-41385 Change-Id: I2cf419f59aa008fa3aca11295fe7d42c40bcc32e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/corelib/tools/qlocale.cpp')
-rw-r--r--src/corelib/tools/qlocale.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp
index f7a6f35183..09b148ea9e 100644
--- a/src/corelib/tools/qlocale.cpp
+++ b/src/corelib/tools/qlocale.cpp
@@ -852,6 +852,8 @@ QLocale::QLocale(const QString &name)
QLocale::QLocale()
: d(*defaultLocalePrivate)
{
+ // Make sure system data is up to date
+ systemData();
}
/*!