[at-spi2-core] Use app_hash to find app to remove in response to NameOwnerChanged



commit e49a52f124d7e10f3ae1ba8e2a6d7a50532de0f0
Author: Mike Gorse <mgorse suse com>
Date:   Thu Sep 11 14:31:51 2014 -0500

    Use app_hash to find app to remove in response to NameOwnerChanged
    
    Previously, we were fetching the desktop, and apparently this may return
    NULL if the registry is gone. I'm not sure if this should be happening,
    and I have no idea if there may be other NULL pointer dereferences in
    that case, but this removes one of them and simplifies the code a bit.

 atspi/atspi-misc.c |   14 ++++----------
 1 files changed, 4 insertions(+), 10 deletions(-)
---
diff --git a/atspi/atspi-misc.c b/atspi/atspi-misc.c
index 4c35df8..84669a4 100644
--- a/atspi/atspi-misc.c
+++ b/atspi/atspi-misc.c
@@ -384,17 +384,11 @@ handle_name_owner_changed (DBusConnection *bus, DBusMessage *message, void *user
     else if (!new[0])
       registry_lost = TRUE;
   }
-  else
+  else if (app_hash)
   {
-    AtspiAccessible *desktop = atspi_get_desktop (0);
-    GList *l;
-    for (l = desktop->children; l; l = l->next)
-    {
-      AtspiAccessible *child = l->data;
-      if (!strcmp (child->parent.app->bus_name, old))
-        g_object_run_dispose (G_OBJECT (child->parent.app));
-    }
-    g_object_unref (desktop);
+    AtspiApplication *app = g_hash_table_lookup (app_hash, old);
+    if (app)
+      g_object_run_dispose (G_OBJECT (app));
   }
   return DBUS_HANDLER_RESULT_HANDLED;
 }


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