Don't try to unref an object if atk returned NULL
authorMike Gorse <mgorse@novell.com>
Mon, 30 Jan 2012 01:03:13 +0000 (19:03 -0600)
committerMike Gorse <mgorse@novell.com>
Mon, 30 Jan 2012 01:04:05 +0000 (19:04 -0600)
atk-adaptor/adaptors/component-adaptor.c
atk-adaptor/adaptors/selection-adaptor.c
atk-adaptor/adaptors/table-adaptor.c

index f477348..d74c764 100644 (file)
@@ -86,7 +86,8 @@ impl_GetAccessibleAtPoint (DBusConnection * bus, DBusMessage * message,
     atk_component_ref_accessible_at_point (component, x, y,
                                            (AtkCoordType) coord_type);
   reply = spi_object_return_reference (message, child);
     atk_component_ref_accessible_at_point (component, x, y,
                                            (AtkCoordType) coord_type);
   reply = spi_object_return_reference (message, child);
-  g_object_unref (child);
+  if (child)
+    g_object_unref (child);
 
   return reply;
 }
 
   return reply;
 }
index 23b0a4f..b39b22d 100644 (file)
@@ -69,7 +69,8 @@ impl_GetSelectedChild (DBusConnection * bus, DBusMessage * message,
     }
   atk_object = atk_selection_ref_selection (selection, selectedChildIndex);
   reply = spi_object_return_reference (message, atk_object);
     }
   atk_object = atk_selection_ref_selection (selection, selectedChildIndex);
   reply = spi_object_return_reference (message, atk_object);
-  g_object_unref (atk_object);
+  if (atk_object)
+    g_object_unref (atk_object);
 
   return reply;
 }
 
   return reply;
 }
index 26fec2b..8c334b6 100644 (file)
@@ -110,7 +110,8 @@ impl_GetAccessibleAt (DBusConnection * bus, DBusMessage * message,
     }
   obj = atk_table_ref_at (table, row, column);
   reply = spi_object_return_reference (message, obj);
     }
   obj = atk_table_ref_at (table, row, column);
   reply = spi_object_return_reference (message, obj);
-  g_object_unref (obj);
+  if (obj)
+    g_object_unref (obj);
 
   return reply;
 }
 
   return reply;
 }
@@ -629,9 +630,8 @@ impl_GetRowColumnExtentsAtIndex (DBusConnection * bus, DBusMessage * message,
   dbus_bool_t is_selected;
   dbus_bool_t ret;
   DBusMessage *reply;
   dbus_bool_t is_selected;
   dbus_bool_t ret;
   DBusMessage *reply;
-
   AtkObject *cell;
   AtkObject *cell;
-  AtkRole role;
+  AtkRole role = ATK_ROLE_INVALID;
 
   g_return_val_if_fail (ATK_IS_TABLE (user_data),
                         droute_not_yet_handled_error (message));
 
   g_return_val_if_fail (ATK_IS_TABLE (user_data),
                         droute_not_yet_handled_error (message));
@@ -647,8 +647,11 @@ impl_GetRowColumnExtentsAtIndex (DBusConnection * bus, DBusMessage * message,
   col_extents = atk_table_get_column_extent_at (table, row, column);
   is_selected = atk_table_is_selected (table, row, column);
   cell = atk_table_ref_at (table, row, column);
   col_extents = atk_table_get_column_extent_at (table, row, column);
   is_selected = atk_table_is_selected (table, row, column);
   cell = atk_table_ref_at (table, row, column);
-  role = atk_object_get_role (cell);
-  g_object_unref (cell);
+  if (cell)
+  {
+    role = atk_object_get_role (cell);
+    g_object_unref (cell);
+  }
   ret = (role == ATK_ROLE_TABLE_CELL ? TRUE : FALSE);
   reply = dbus_message_new_method_return (message);
   if (reply)
   ret = (role == ATK_ROLE_TABLE_CELL ? TRUE : FALSE);
   reply = dbus_message_new_method_return (message);
   if (reply)