Title: [152706] trunk/Source/WTF
Revision
152706
Author
[email protected]
Date
2013-07-15 23:32:43 -0700 (Mon, 15 Jul 2013)

Log Message

Add a threading assertion to AtomicString::remove
https://bugs.webkit.org/show_bug.cgi?id=118695

Reviewed by Sam Weinig.

* wtf/text/AtomicString.cpp:
(WTF::AtomicString::remove): The destructor of StringImpl remove
the string from the string table if it is atomic. This needs to be done
on the same thread as the one on which the string was added (otherwise the original
table would keep a dangling pointer to a dead string).

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (152705 => 152706)


--- trunk/Source/WTF/ChangeLog	2013-07-16 05:19:36 UTC (rev 152705)
+++ trunk/Source/WTF/ChangeLog	2013-07-16 06:32:43 UTC (rev 152706)
@@ -1,5 +1,18 @@
 2013-07-15  Benjamin Poulain  <[email protected]>
 
+        Add a threading assertion to AtomicString::remove
+        https://bugs.webkit.org/show_bug.cgi?id=118695
+
+        Reviewed by Sam Weinig.
+
+        * wtf/text/AtomicString.cpp:
+        (WTF::AtomicString::remove): The destructor of StringImpl remove
+        the string from the string table if it is atomic. This needs to be done
+        on the same thread as the one on which the string was added (otherwise the original
+        table would keep a dangling pointer to a dead string).
+
+2013-07-15  Benjamin Poulain  <[email protected]>
+
         Minor cleaning of AtomicString::addSlowCase
         https://bugs.webkit.org/show_bug.cgi?id=118615
 

Modified: trunk/Source/WTF/wtf/text/AtomicString.cpp (152705 => 152706)


--- trunk/Source/WTF/wtf/text/AtomicString.cpp	2013-07-16 05:19:36 UTC (rev 152705)
+++ trunk/Source/WTF/wtf/text/AtomicString.cpp	2013-07-16 06:32:43 UTC (rev 152706)
@@ -421,10 +421,14 @@
     return static_cast<AtomicStringImpl*>(*iterator);
 }
 
-void AtomicString::remove(StringImpl* r)
+void AtomicString::remove(StringImpl* string)
 {
+    ASSERT(string->isAtomic());
     AtomicStringTableLocker locker;
-    stringTable().remove(r);
+    HashSet<StringImpl*>& atomicStringTable = stringTable();
+    HashSet<StringImpl*>::iterator iterator = atomicStringTable.find(string);
+    ASSERT_WITH_MESSAGE(iterator != atomicStringTable.end(), "The string being removed is atomic in the string table of an other thread!");
+    atomicStringTable.remove(iterator);
 }
 
 AtomicString AtomicString::lower() const
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to