summaryrefslogtreecommitdiffstats
path: root/chromium/third_party/icu/patches/timezone.patch
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/icu/patches/timezone.patch')
-rw-r--r--chromium/third_party/icu/patches/timezone.patch52
1 files changed, 52 insertions, 0 deletions
diff --git a/chromium/third_party/icu/patches/timezone.patch b/chromium/third_party/icu/patches/timezone.patch
new file mode 100644
index 00000000000..bf7e1729aef
--- /dev/null
+++ b/chromium/third_party/icu/patches/timezone.patch
@@ -0,0 +1,52 @@
+diff --git a/source/i18n/timezone.cpp b/source/i18n/timezone.cpp
+index f129d8b6..32214d72 100644
+--- a/source/i18n/timezone.cpp
++++ b/source/i18n/timezone.cpp
+@@ -527,6 +527,11 @@ TimeZone::detectHostTimeZone()
+
+ // -------------------------------------
+
++static UMutex *gDefaultZoneMutex() {
++ static UMutex* m = new UMutex();
++ return m;
++}
++
+ /**
+ * Initialize DEFAULT_ZONE from the system default time zone.
+ * Upon return, DEFAULT_ZONE will not be NULL, unless operator new()
+@@ -536,6 +541,7 @@ static void U_CALLCONV initDefault()
+ {
+ ucln_i18n_registerCleanup(UCLN_I18N_TIMEZONE, timeZone_cleanup);
+
++ Mutex lock(gDefaultZoneMutex());
+ // If setDefault() has already been called we can skip getting the
+ // default zone information from the system.
+ if (DEFAULT_ZONE != NULL) {
+@@ -571,7 +577,10 @@ TimeZone* U_EXPORT2
+ TimeZone::createDefault()
+ {
+ umtx_initOnce(gDefaultZoneInitOnce, initDefault);
+- return (DEFAULT_ZONE != NULL) ? DEFAULT_ZONE->clone() : NULL;
++ {
++ Mutex lock(gDefaultZoneMutex());
++ return (DEFAULT_ZONE != NULL) ? DEFAULT_ZONE->clone() : NULL;
++ }
+ }
+
+ // -------------------------------------
+@@ -581,9 +590,12 @@ TimeZone::adoptDefault(TimeZone* zone)
+ {
+ if (zone != NULL)
+ {
+- TimeZone *old = DEFAULT_ZONE;
+- DEFAULT_ZONE = zone;
+- delete old;
++ {
++ Mutex lock(gDefaultZoneMutex());
++ TimeZone *old = DEFAULT_ZONE;
++ DEFAULT_ZONE = zone;
++ delete old;
++ }
+ ucln_i18n_registerCleanup(UCLN_I18N_TIMEZONE, timeZone_cleanup);
+ }
+ }