summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools
diff options
context:
space:
mode:
authorDenis Dzyubenko <denis.dzyubenko@nokia.com>2009-10-07 10:16:04 (GMT)
committeraxis <qt-info@nokia.com>2009-10-07 11:52:11 (GMT)
commit0418d438d1c1acfe2c95ee748c1e7c84a0ee8837 (patch)
tree8cc28c8b690f101f68430314e6ff7ce1b6928daf /src/corelib/tools
parent5ce632d3a8354f118225911103628e602559124e (diff)
downloadQt-0418d438d1c1acfe2c95ee748c1e7c84a0ee8837.zip
Qt-0418d438d1c1acfe2c95ee748c1e7c84a0ee8837.tar.gz
Qt-0418d438d1c1acfe2c95ee748c1e7c84a0ee8837.tar.bz2
Fixed initialization of the system locale on Symbian.
Made it thread-safe and actually make sure that we don't initialize the data several times. Reviewed-by: axis
Diffstat (limited to 'src/corelib/tools')
-rw-r--r--src/corelib/tools/qlocale_symbian.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/corelib/tools/qlocale_symbian.cpp b/src/corelib/tools/qlocale_symbian.cpp
index 931fbb4..1660e95 100644
--- a/src/corelib/tools/qlocale_symbian.cpp
+++ b/src/corelib/tools/qlocale_symbian.cpp
@@ -43,6 +43,7 @@
#include <QLocale>
#include <QTime>
#include <QVariant>
+#include <QThread>
#include <e32std.h>
#include "private/qcore_symbian_p.h"
@@ -773,8 +774,8 @@ static QLocale::MeasurementSystem symbianMeasurementSystem()
QLocale QSystemLocale::fallbackLocale() const
{
// load system data before query calls
- static bool initDone = false;
- if (!initDone) {
+ static QBasicAtomicInt initDone = Q_BASIC_ATOMIC_INITIALIZER(0);
+ if (initDone.testAndSetRelaxed(0, 1)) {
_s60Locale.LoadSystemSettings();
// Initialize platform version dependent function pointers
@@ -794,7 +795,12 @@ QLocale QSystemLocale::fallbackLocale() const
ptrGetLongDateFormatSpec = &defaultFormatSpec;
if (!ptrGetShortDateFormatSpec)
ptrGetShortDateFormatSpec = &defaultFormatSpec;
+ bool ret = initDone.testAndSetRelease(1, 2);
+ Q_ASSERT(ret);
+ Q_UNUSED(ret);
}
+ while(initDone != 2)
+ QThread::yieldCurrentThread();
TLanguage lang = User::Language();
QString locale = QLatin1String(qt_symbianLocaleName(lang));