Fix a possible crash when an application is short-lived
authorMike Gorse <mgorse@novell.com>
Wed, 4 May 2011 19:34:48 +0000 (14:34 -0500)
committerMike Gorse <mgorse@novell.com>
Wed, 4 May 2011 19:41:32 +0000 (14:41 -0500)
When GetAPplicationBusAddress is called, at-spi sets a callback to handle the
reply.  It is possible that the application will go away and the
AtspiApplication will be disposed before this callback is reached, in which
case the reference to the accessibility bus connection will have gone away.
In this case, we should not call GetItems, since app->bus will be NULL and
libdbus will throw a SIGABRT.

atspi/atspi-misc.c

index c4a90ab..886f92c 100644 (file)
@@ -162,6 +162,9 @@ handle_get_bus_address (DBusPendingCall *pending, void *user_data)
   dbus_message_unref (reply);
   dbus_pending_call_unref (pending);
 
+  if (!app->bus)
+    return; /* application has gone away / been disposed */
+
   message = dbus_message_new_method_call (app->bus_name,
                                           "/org/a11y/atspi/cache",
                                           atspi_interface_cache, "GetItems");