Bug 217271

Summary: std::once_flag must be allocated in static storage
Product: WebKit Reporter: Yusuke Suzuki <ysuzuki>
Component: New BugsAssignee: Yusuke Suzuki <ysuzuki>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, darin, ddkilzer, ews-watchlist, glenn, jbedard, mark.lam, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch mark.lam: review+

Yusuke Suzuki
Reported 2020-10-02 19:44:17 PDT
std::once_flag must be allocated in static storage
Attachments
Patch (7.57 KB, patch)
2020-10-02 19:48 PDT, Yusuke Suzuki
mark.lam: review+
Yusuke Suzuki
Comment 1 2020-10-02 19:48:21 PDT
Mark Lam
Comment 2 2020-10-02 20:19:21 PDT
Comment on attachment 410407 [details] Patch r=me
Mark Lam
Comment 3 2020-10-02 20:24:41 PDT
Comment on attachment 410407 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=410407&action=review > Source/WebCore/ChangeLog:8 > + Since std::once_flag is an usual variable, this does not prevent us from calling it multiple times. Did you mean "If the std::once_flag is a non-static variable, it will not prevent ..."?
Yusuke Suzuki
Comment 4 2020-10-02 23:00:30 PDT
Yusuke Suzuki
Comment 5 2020-10-02 23:00:52 PDT
Comment on attachment 410407 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=410407&action=review >> Source/WebCore/ChangeLog:8 >> + Since std::once_flag is an usual variable, this does not prevent us from calling it multiple times. > > Did you mean "If the std::once_flag is a non-static variable, it will not prevent ..."? Fixed.
Radar WebKit Bug Importer
Comment 6 2020-10-02 23:01:15 PDT
Darin Adler
Comment 7 2020-10-03 10:36:23 PDT
Comment on attachment 410407 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=410407&action=review > Source/WebCore/platform/text/TextCodecSingleByte.cpp:180 > - std::once_flag once; > + static std::once_flag once; Oops, guess it was me who made this mistake. Thank you for fixing it!
David Kilzer (:ddkilzer)
Comment 8 2020-10-05 09:26:05 PDT
Sadly, I believe this is caught by the clang static analyzer as well.
Note You need to log in before you can comment on or make changes to this bug.