Bug 34611 - WebLocalizedString() could use an assertion that it is being called on the main thread
: WebLocalizedString() could use an assertion that it is being called on the ma...
Status: RESOLVED FIXED
Product: WebKit
Classification: Unclassified
Component: WebKit Misc.
: 528+ (Nightly build)
: Macintosh All
: P2 Normal
Assigned To: John Sullivan
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-02-04 13:13 PST by John Sullivan
Modified: 2010-02-04 13:46 PST (History)
0 users

See Also:


Attachments
Patch to add an assertion. (12.50 KB, patch)
2010-02-04 13:41 PST, John Sullivan
timothy: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description John Sullivan 2010-02-04 13:13:19 PST
WebLocalizedString() in WebLocalizableStrings.m is not thread-safe because it performs no internal locking when setting or using the value of a static variable. Also, it calls -[NSBundle localizedStringForKey:], which is not guaranteed to be thread-safe.

To catch thread-safety issues, it would be useful to assert that this function is being called on the main thread.
Comment 1 John Sullivan 2010-02-04 13:41:09 PST
Created attachment 48166 [details]
Patch to add an assertion.
Comment 2 John Sullivan 2010-02-04 13:46:13 PST
Fixed in <http://trac.webkit.org/changeset/54367>