Add some defensive checks to prevent problems with defunct objects
authorMike Gorse <mgorse@novell.com>
Thu, 15 Sep 2011 21:41:28 +0000 (16:41 -0500)
committerMike Gorse <mgorse@novell.com>
Thu, 15 Sep 2011 21:41:28 +0000 (16:41 -0500)
atspi/atspi-collection.c
atspi/atspi-component.c
atspi/atspi-value.c
registryd/registry.c

index 210a0cdb482055d4a120eaf666a6bf543c1d7f73..a96575728fd8fdd68ee69c9e815fa866bfaebfe7 100644 (file)
@@ -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,
index 3c84fb94b1d58eedd2a4e68da93ba5630f6d8663..24d74d41380e0cce511be6d77646cf3c075e14f1 100644 (file)
@@ -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))
index fbd957308992dccb6f57596158850733a952dbff..a8df846579ae26d91835ab4f4578a2cc26a66c74 100644 (file)
@@ -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");
index f486fd699b1177108b99d456f17a2437bc0f331d..d722f1793a06e4fbc84c3158b4c392855d09e38c 100644 (file)
@@ -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))