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
: WebKit
WebKit Misc.
: 528+ (Nightly build)
: Macintosh All
: P2 Normal
Assigned To:
:
:
:
:
  Show dependency treegraph
 
Reported: 2010-02-04 13:13 PST by
Modified: 2010-02-04 13:46 PST (History)


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


Note

You need to log in before you can comment on or make changes to this bug.


Description From 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 From 2010-02-04 13:41:09 PST -------
Created an attachment (id=48166) [details]
Patch to add an assertion.
------- Comment #2 From 2010-02-04 13:46:13 PST -------
Fixed in <http://trac.webkit.org/changeset/54367>