[at-spi2-atk] Don't try to unref an object if atk returned NULL
- From: Mike Gorse <mgorse src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [at-spi2-atk] Don't try to unref an object if atk returned NULL
- Date: Mon, 30 Jan 2012 01:00:59 +0000 (UTC)
commit b127ebb72cce5c710445b1c823379256921f1e45
Author: Mike Gorse <mgorse novell com>
Date: Sun Jan 29 19:03:13 2012 -0600
Don't try to unref an object if atk returned NULL
atk-adaptor/adaptors/component-adaptor.c | 3 ++-
atk-adaptor/adaptors/selection-adaptor.c | 3 ++-
atk-adaptor/adaptors/table-adaptor.c | 13 ++++++++-----
3 files changed, 12 insertions(+), 7 deletions(-)
---
diff --git a/atk-adaptor/adaptors/component-adaptor.c b/atk-adaptor/adaptors/component-adaptor.c
index f477348..d74c764 100644
--- a/atk-adaptor/adaptors/component-adaptor.c
+++ b/atk-adaptor/adaptors/component-adaptor.c
@@ -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);
- g_object_unref (child);
+ if (child)
+ g_object_unref (child);
return reply;
}
diff --git a/atk-adaptor/adaptors/selection-adaptor.c b/atk-adaptor/adaptors/selection-adaptor.c
index 23b0a4f..b39b22d 100644
--- a/atk-adaptor/adaptors/selection-adaptor.c
+++ b/atk-adaptor/adaptors/selection-adaptor.c
@@ -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);
- g_object_unref (atk_object);
+ if (atk_object)
+ g_object_unref (atk_object);
return reply;
}
diff --git a/atk-adaptor/adaptors/table-adaptor.c b/atk-adaptor/adaptors/table-adaptor.c
index 26fec2b..8c334b6 100644
--- a/atk-adaptor/adaptors/table-adaptor.c
+++ b/atk-adaptor/adaptors/table-adaptor.c
@@ -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);
- g_object_unref (obj);
+ if (obj)
+ g_object_unref (obj);
return reply;
}
@@ -629,9 +630,8 @@ impl_GetRowColumnExtentsAtIndex (DBusConnection * bus, DBusMessage * message,
dbus_bool_t is_selected;
dbus_bool_t ret;
DBusMessage *reply;
-
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));
@@ -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);
- 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)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]