summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Gorse <mgorse@suse.com>2014-09-11 14:31:51 -0500
committerMike Gorse <mgorse@suse.com>2014-09-11 14:31:51 -0500
commite49a52f124d7e10f3ae1ba8e2a6d7a50532de0f0 (patch)
tree45370486a8c8d45863f84c4466dc6785f078e514
parent54d3b53515eb2ddbef32ad12446bd8c9fd731c3f (diff)
downloadat-spi2-core-e49a52f124d7e10f3ae1ba8e2a6d7a50532de0f0.tar.gz
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.
-rw-r--r--atspi/atspi-misc.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/atspi/atspi-misc.c b/atspi/atspi-misc.c
index 4c35df88..84669a47 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;
}