NEW 133936
API::String is not thread-safe
https://bugs.webkit.org/show_bug.cgi?id=133936
Summary API::String is not thread-safe
mitz
Reported 2014-06-15 23:40:09 PDT
API::String is not thread-safe
Attachments
Safely dispose of m_string on the main thread (3.62 KB, patch)
2014-06-16 00:09 PDT, mitz
no flags
Safely dispose of m_string on the main thread (3.76 KB, patch)
2014-06-16 22:16 PDT, mitz
no flags
mitz
Comment 1 2014-06-16 00:09:13 PDT
Created attachment 233152 [details] Safely dispose of m_string on the main thread
WebKit Commit Bot
Comment 2 2014-06-16 00:11:33 PDT
Attachment 233152 [details] did not pass style-queue: ERROR: Source/WebKit2/Shared/APIString.h:133: Should be indented on a separate line, with the colon or comma first on that line. [whitespace/indent] [4] Total errors found: 1 in 3 files If any of these errors are false positives, please file a bug against check-webkit-style.
Anders Carlsson
Comment 3 2014-06-16 16:11:18 PDT
Comment on attachment 233152 [details] Safely dispose of m_string on the main thread View in context: https://bugs.webkit.org/attachment.cgi?id=233152&action=review > Source/WebKit2/Shared/APIString.h:68 > + WTF::String string = std::move(m_string); Can use auto here. > Source/WebKit2/Shared/APIString.h:69 > + RunLoop::main().dispatch([string]() { }); I think this needs a comment. > Source/WebKit2/Shared/APIString.h:115 > + RunLoop::main().dispatch([string]() { }); I think this needs a comment.
mitz
Comment 4 2014-06-16 22:16:23 PDT
Created attachment 233218 [details] Safely dispose of m_string on the main thread
WebKit Commit Bot
Comment 5 2014-06-16 22:18:55 PDT
Attachment 233218 [details] did not pass style-queue: ERROR: Source/WebKit2/Shared/APIString.h:135: Should be indented on a separate line, with the colon or comma first on that line. [whitespace/indent] [4] Total errors found: 1 in 3 files If any of these errors are false positives, please file a bug against check-webkit-style.
Anders Carlsson
Comment 6 2014-06-18 08:24:58 PDT
Comment on attachment 233218 [details] Safely dispose of m_string on the main thread What if the string is created off the main thread?
mitz
Comment 7 2014-06-18 08:43:44 PDT
(In reply to comment #6) > (From update of attachment 233218 [details]) > What if the string is created off the main thread? In that case we make an isolated copy at creation time, so we are free to dispose of it on the main thread eventually. The invariant is that m_string is always safe to destroy on the main thread.
mitz
Comment 8 2014-06-18 08:52:12 PDT
Oh, I think you're saying that the string() accessor may violate the invariant. It should just make an isolated copy and return it whenever it's called off the main thread.
mitz
Comment 9 2014-12-04 17:08:12 PST
The fix for bug 139261 made API::String copy unconditionally on creation.
Note You need to log in before you can comment on or make changes to this bug.