LazyNeverDestroyed is not thread safe in debug builds, causing assertions
authorap@apple.com <ap@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 30 Apr 2015 03:05:37 +0000 (03:05 +0000)
committerap@apple.com <ap@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 30 Apr 2015 03:05:37 +0000 (03:05 +0000)
https://bugs.webkit.org/show_bug.cgi?id=144378

Reviewed by Darin Adler.

* wtf/NeverDestroyed.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@183608 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WTF/ChangeLog
Source/WTF/wtf/NeverDestroyed.h

index 145d68c..1901795 100644 (file)
@@ -1,3 +1,12 @@
+2015-04-29  Alexey Proskuryakov  <ap@apple.com>
+
+        LazyNeverDestroyed is not thread safe in debug builds, causing assertions
+        https://bugs.webkit.org/show_bug.cgi?id=144378
+
+        Reviewed by Darin Adler.
+
+        * wtf/NeverDestroyed.h:
+
 2015-04-28  Geoffrey Garen  <ggaren@apple.com>
 
         It shouldn't take 1846 lines of code and 5 FIXMEs to sort an array.
index cf4311f..c7f76d9 100644 (file)
@@ -116,7 +116,9 @@ private:
     };
 
 #if !ASSERT_DISABLED
-    bool m_isConstructed = false;
+    // LazyNeverDestroyed objects are always static, so this variable is initialized to false.
+    // It must not be initialized dynamically, because that would not be thread safe.
+    bool m_isConstructed;
 #endif
 };