Title: [93952] trunk/Source/WebCore
Revision
93952
Author
[email protected]
Date
2011-08-28 17:26:19 -0700 (Sun, 28 Aug 2011)

Log Message

Fix reference counting of values in CSSSelector.
https://bugs.webkit.org/show_bug.cgi?id=66452

Reviewed by Darin Adler.

No new tests / no functionality changed.

Call deref when reassigning the value.

* css/CSSSelector.h:
(WebCore::CSSSelector::setValue):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (93951 => 93952)


--- trunk/Source/WebCore/ChangeLog	2011-08-28 23:58:25 UTC (rev 93951)
+++ trunk/Source/WebCore/ChangeLog	2011-08-29 00:26:19 UTC (rev 93952)
@@ -1,3 +1,17 @@
+2011-08-28  Luke Macpherson   <[email protected]>
+
+        Fix reference counting of values in CSSSelector.
+        https://bugs.webkit.org/show_bug.cgi?id=66452
+
+        Reviewed by Darin Adler.
+
+        No new tests / no functionality changed.
+
+        Call deref when reassigning the value.
+
+        * css/CSSSelector.h:
+        (WebCore::CSSSelector::setValue):
+
 2011-08-28  Sam Weinig  <[email protected]>
 
         Add support for constructor syntax for Events

Modified: trunk/Source/WebCore/css/CSSSelector.h (93951 => 93952)


--- trunk/Source/WebCore/css/CSSSelector.h	2011-08-28 23:58:25 UTC (rev 93951)
+++ trunk/Source/WebCore/css/CSSSelector.h	2011-08-29 00:26:19 UTC (rev 93952)
@@ -229,7 +229,7 @@
         const QualifiedName& attribute() const;
         const AtomicString& argument() const { return m_hasRareData ? m_data.m_rareData->m_argument : nullAtom; }
         CSSSelectorList* selectorList() const { return m_hasRareData ? m_data.m_rareData->m_selectorList.get() : 0; }
-        
+
         void setTag(const QualifiedName& value) { m_tag = value; }
         void setValue(const AtomicString&);
         void setAttribute(const QualifiedName&);
@@ -328,13 +328,17 @@
 }
     
 inline void CSSSelector::setValue(const AtomicString& value)
-{ 
+{
     // Need to do ref counting manually for the union.
     if (m_hasRareData) {
+        if (m_data.m_rareData->m_value)
+            m_data.m_rareData->m_value->deref();
         m_data.m_rareData->m_value = value.impl();
         m_data.m_rareData->m_value->ref();
         return;
     }
+    if (m_data.m_value)
+        m_data.m_value->deref();
     m_data.m_value = value.impl();
     m_data.m_value->ref();
 }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to