Changeset 49814 in webkit
- Timestamp:
- Oct 19, 2009 3:00:12 PM (15 years ago)
- Location:
- trunk/WebKit/win
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit/win/ChangeLog
r49813 r49814 1 2009-10-19 Adam Roben <aroben@apple.com> 2 3 Fix crashes/assertions when calling WebLocalizedString from multiple 4 threads concurrently 5 6 Fixes <http://webkit.org/b/30534> WebLocalizedString asserts if called 7 from multiple threads concurrently 8 9 Reviewed by John Sullivan. 10 11 * WebLocalizableStrings.cpp: 12 (mainBundleLocStringsMutex): 13 (frameworkLocStringsMutex): 14 Added these new getters. 15 16 (findCachedString): 17 (cacheString): 18 Lock the relevant mutex before accessing each string map. Otherwise 19 bad things could happen if two threads end up here at the same time. 20 1 21 2009-10-19 Adam Roben <aroben@apple.com> 2 22 -
trunk/WebKit/win/WebLocalizableStrings.cpp
r49813 r49814 49 49 typedef HashMap<String, LocalizedString*> LocalizedStringMap; 50 50 51 static Mutex& mainBundleLocStringsMutex() 52 { 53 DEFINE_STATIC_LOCAL(Mutex, mutex, ()); 54 return mutex; 55 } 56 51 57 static LocalizedStringMap& mainBundleLocStrings() 52 58 { 53 59 DEFINE_STATIC_LOCAL(LocalizedStringMap, map, ()); 54 60 return map; 61 } 62 63 static Mutex& frameworkLocStringsMutex() 64 { 65 DEFINE_STATIC_LOCAL(Mutex, mutex, ()); 66 return mutex; 55 67 } 56 68 … … 169 181 static LocalizedString* findCachedString(WebLocalizableStringsBundle* stringsBundle, const String& key) 170 182 { 171 if (!stringsBundle) 183 if (!stringsBundle) { 184 MutexLocker lock(mainBundleLocStringsMutex()); 172 185 return mainBundleLocStrings().get(key); 173 174 if (stringsBundle->bundle == WebKitLocalizableStringsBundle.bundle) 186 } 187 188 if (stringsBundle->bundle == WebKitLocalizableStringsBundle.bundle) { 189 MutexLocker lock(frameworkLocStringsMutex()); 175 190 return frameworkLocStrings().get(key); 191 } 176 192 177 193 return 0; … … 181 197 { 182 198 if (!stringsBundle) { 199 MutexLocker lock(mainBundleLocStringsMutex()); 183 200 mainBundleLocStrings().set(key, value); 184 201 return; 185 202 } 186 203 204 MutexLocker lock(frameworkLocStringsMutex()); 187 205 frameworkLocStrings().set(key, value); 188 206 }
Note: See TracChangeset
for help on using the changeset viewer.