[at-spi2-core] Fix a possible crash when an application is short-lived



commit b592fea73b4e86463465fb934f45c126277fbdd6
Author: Mike Gorse <mgorse novell com>
Date:   Wed May 4 14:34:48 2011 -0500

    Fix a possible crash when an application is short-lived
    
    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 |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
---
diff --git a/atspi/atspi-misc.c b/atspi/atspi-misc.c
index c4a90ab..886f92c 100644
--- a/atspi/atspi-misc.c
+++ b/atspi/atspi-misc.c
@@ -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");



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]