[Gtk] Several tests launch g_object_ref/unref assertion messages
authorzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 2 Oct 2012 17:00:24 +0000 (17:00 +0000)
committerzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 2 Oct 2012 17:00:24 +0000 (17:00 +0000)
https://bugs.webkit.org/show_bug.cgi?id=95062

Reviewed by Martin Robinson.

Only increase and decrease reference count of the accessibility
UI element if it actually exists.

* DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp:
(AccessibilityUIElement::AccessibilityUIElement):
(AccessibilityUIElement::~AccessibilityUIElement):

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

Tools/ChangeLog
Tools/DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp

index 2f770a9..db14a10 100644 (file)
@@ -1,3 +1,17 @@
+2012-10-02  Zan Dobersek  <zandobersek@gmail.com>
+
+        [Gtk] Several tests launch g_object_ref/unref assertion messages
+        https://bugs.webkit.org/show_bug.cgi?id=95062
+
+        Reviewed by Martin Robinson.
+
+        Only increase and decrease reference count of the accessibility
+        UI element if it actually exists.
+
+        * DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp:
+        (AccessibilityUIElement::AccessibilityUIElement):
+        (AccessibilityUIElement::~AccessibilityUIElement):
+
 2012-10-02  Douglas Stockwell  <dstockwell@chromium.org>
 
         [chromium] running layout tests on mountainlion should use chromium TestExpectations
index 6b9edc9..25c49e3 100644 (file)
@@ -56,18 +56,21 @@ static inline gchar* replaceCharactersForResults(gchar* str)
 AccessibilityUIElement::AccessibilityUIElement(PlatformUIElement element)
     : m_element(element)
 {
-    g_object_ref(m_element);
+    if (m_element)
+        g_object_ref(m_element);
 }
 
 AccessibilityUIElement::AccessibilityUIElement(const AccessibilityUIElement& other)
     : m_element(other.m_element)
 {
-    g_object_ref(m_element);
+    if (m_element)
+        g_object_ref(m_element);
 }
 
 AccessibilityUIElement::~AccessibilityUIElement()
 {
-    g_object_unref(m_element);
+    if (m_element)
+        g_object_unref(m_element);
 }
 
 void AccessibilityUIElement::getLinkedUIElements(Vector<AccessibilityUIElement>& elements)