[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.15.1-1414-gc69ee75
aroben at apple.com
aroben at apple.com
Thu Oct 29 20:48:07 UTC 2009
The following commit has been merged in the webkit-1.1 branch:
commit 9fd819262f399be602f9451c3b044611f00ed540
Author: aroben at apple.com <aroben at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Mon Oct 19 22:00:12 2009 +0000
Fix crashes/assertions when calling WebLocalizedString from multiple threads concurrently
Fixes <http://webkit.org/b/30534> WebLocalizedString asserts if called
from multiple threads concurrently
Reviewed by John Sullivan.
* WebLocalizableStrings.cpp:
(mainBundleLocStringsMutex):
(frameworkLocStringsMutex):
Added these new getters.
(findCachedString):
(cacheString):
Lock the relevant mutex before accessing each string map. Otherwise
bad things could happen if two threads end up here at the same time.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@49814 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit/win/ChangeLog b/WebKit/win/ChangeLog
index 1302a4e..f8aa5a8 100644
--- a/WebKit/win/ChangeLog
+++ b/WebKit/win/ChangeLog
@@ -1,5 +1,25 @@
2009-10-19 Adam Roben <aroben at apple.com>
+ Fix crashes/assertions when calling WebLocalizedString from multiple
+ threads concurrently
+
+ Fixes <http://webkit.org/b/30534> WebLocalizedString asserts if called
+ from multiple threads concurrently
+
+ Reviewed by John Sullivan.
+
+ * WebLocalizableStrings.cpp:
+ (mainBundleLocStringsMutex):
+ (frameworkLocStringsMutex):
+ Added these new getters.
+
+ (findCachedString):
+ (cacheString):
+ Lock the relevant mutex before accessing each string map. Otherwise
+ bad things could happen if two threads end up here at the same time.
+
+2009-10-19 Adam Roben <aroben at apple.com>
+
Get rid of a few static initializers/exit-time destructors in
WebLocalizableStrings
diff --git a/WebKit/win/WebLocalizableStrings.cpp b/WebKit/win/WebLocalizableStrings.cpp
index 552e211..69675e2 100644
--- a/WebKit/win/WebLocalizableStrings.cpp
+++ b/WebKit/win/WebLocalizableStrings.cpp
@@ -48,12 +48,24 @@ WebLocalizableStringsBundle WebKitLocalizableStringsBundle = { "com.apple.WebKit
typedef HashMap<String, LocalizedString*> LocalizedStringMap;
+static Mutex& mainBundleLocStringsMutex()
+{
+ DEFINE_STATIC_LOCAL(Mutex, mutex, ());
+ return mutex;
+}
+
static LocalizedStringMap& mainBundleLocStrings()
{
DEFINE_STATIC_LOCAL(LocalizedStringMap, map, ());
return map;
}
+static Mutex& frameworkLocStringsMutex()
+{
+ DEFINE_STATIC_LOCAL(Mutex, mutex, ());
+ return mutex;
+}
+
static LocalizedStringMap frameworkLocStrings()
{
DEFINE_STATIC_LOCAL(LocalizedStringMap, map, ());
@@ -168,11 +180,15 @@ static CFStringRef copyLocalizedStringFromBundle(WebLocalizableStringsBundle* st
static LocalizedString* findCachedString(WebLocalizableStringsBundle* stringsBundle, const String& key)
{
- if (!stringsBundle)
+ if (!stringsBundle) {
+ MutexLocker lock(mainBundleLocStringsMutex());
return mainBundleLocStrings().get(key);
+ }
- if (stringsBundle->bundle == WebKitLocalizableStringsBundle.bundle)
+ if (stringsBundle->bundle == WebKitLocalizableStringsBundle.bundle) {
+ MutexLocker lock(frameworkLocStringsMutex());
return frameworkLocStrings().get(key);
+ }
return 0;
}
@@ -180,10 +196,12 @@ static LocalizedString* findCachedString(WebLocalizableStringsBundle* stringsBun
static void cacheString(WebLocalizableStringsBundle* stringsBundle, const String& key, LocalizedString* value)
{
if (!stringsBundle) {
+ MutexLocker lock(mainBundleLocStringsMutex());
mainBundleLocStrings().set(key, value);
return;
}
+ MutexLocker lock(frameworkLocStringsMutex());
frameworkLocStrings().set(key, value);
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list