[Gtk] Several tests launch g_object_ref/unref assertion messages
[WebKit-https.git] / Tools / DumpRenderTree / gtk / AccessibilityUIElementGtk.cpp
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)