diff options
author | Mike Gorse <mgorse@novell.com> | 2011-09-15 16:41:28 -0500 |
---|---|---|
committer | Mike Gorse <mgorse@novell.com> | 2011-09-15 16:41:28 -0500 |
commit | d4e6ce638f4178ea9737ff8aa6d10f49dfca4f58 (patch) | |
tree | e1192fa5d1f86feadc65824079993df44f26ce64 | |
parent | c0e7c34fc7b8e3a5f117a7c852c5110ad1a37e46 (diff) | |
download | at-spi2-core-d4e6ce638f4178ea9737ff8aa6d10f49dfca4f58.tar.gz |
Add some defensive checks to prevent problems with defunct objects
-rw-r--r-- | atspi/atspi-collection.c | 2 | ||||
-rw-r--r-- | atspi/atspi-component.c | 9 | ||||
-rw-r--r-- | atspi/atspi-value.c | 8 | ||||
-rw-r--r-- | registryd/registry.c | 2 |
4 files changed, 21 insertions, 0 deletions
diff --git a/atspi/atspi-collection.c b/atspi/atspi-collection.c index 210a0cdb..a9657572 100644 --- a/atspi/atspi-collection.c +++ b/atspi/atspi-collection.c @@ -49,6 +49,8 @@ new_message (AtspiCollection *collection, char *method) return NULL; accessible = ATSPI_ACCESSIBLE (collection); + if (!accessible->parent.app) + return NULL; return dbus_message_new_method_call (accessible->parent.app->bus_name, accessible->parent.path, atspi_interface_collection, diff --git a/atspi/atspi-component.c b/atspi/atspi-component.c index 3c84fb94..24d74d41 100644 --- a/atspi/atspi-component.c +++ b/atspi/atspi-component.c @@ -307,10 +307,19 @@ atspi_component_set_extents (AtspiComponent *obj, g_return_val_if_fail (obj != NULL, FALSE); + if (!aobj->parent.app || !aobj->parent.app->bus_name) + { + g_set_error_literal (error, ATSPI_ERROR, ATSPI_ERROR_APPLICATION_GONE, + _("The application no longer exists")); + return FALSE; + } + message = dbus_message_new_method_call (aobj->parent.app->bus_name, aobj->parent.path, atspi_interface_component, "SetExtents"); + if (!message) + return FALSE; dbus_message_iter_init_append (message, &iter); if (!dbus_message_iter_open_container (&iter, DBUS_TYPE_STRUCT, NULL, &iter_struct)) diff --git a/atspi/atspi-value.c b/atspi/atspi-value.c index fbd95730..a8df8465 100644 --- a/atspi/atspi-value.c +++ b/atspi/atspi-value.c @@ -104,6 +104,14 @@ atspi_value_set_current_value (AtspiValue *obj, gdouble new_value, GError **erro AtspiAccessible *accessible = ATSPI_ACCESSIBLE (obj); g_return_val_if_fail (accessible != NULL, FALSE); + + if (!accessible->parent.app || !accessible->parent.app->bus_name) +{ + g_set_error_literal (error, ATSPI_ERROR, ATSPI_ERROR_APPLICATION_GONE, + _("The application no longer exists")); + return FALSE; + } + message = dbus_message_new_method_call (accessible->parent.app->bus_name, accessible->parent.path, DBUS_INTERFACE_PROPERTIES, "Set"); diff --git a/registryd/registry.c b/registryd/registry.c index f486fd69..d722f179 100644 --- a/registryd/registry.c +++ b/registryd/registry.c @@ -375,6 +375,8 @@ impl_Embed (DBusConnection *bus, DBusMessage *message, void *user_data) if (!(dbus_message_iter_get_arg_type (&iter_struct) == DBUS_TYPE_STRING)) goto error; dbus_message_iter_get_basic (&iter_struct, &app_name); + if (!app_name) + app_name = dbus_message_get_sender (message); if (!dbus_message_iter_next (&iter_struct)) goto error; if (!(dbus_message_iter_get_arg_type (&iter_struct) == DBUS_TYPE_OBJECT_PATH)) |