From c46e38d7ab03589a7c7d4fd5fa52ef0bb5f1a9d5 Mon Sep 17 00:00:00 2001 From: Lars Uebernickel Date: Fri, 14 Dec 2012 10:56:00 +0100 Subject: im_application_list_proxy_created: fix error condition Also, don't print a warning when the proy couldn't be created because the operation was cancelled. This only happens when the service is shutting down or when one application replaces another one with the same desktop file (in which case we already warn with a more descriptive message). --- src/im-application-list.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/im-application-list.c b/src/im-application-list.c index 5a7f768..d3d8dad 100644 --- a/src/im-application-list.c +++ b/src/im-application-list.c @@ -796,9 +796,10 @@ im_application_list_proxy_created (GObject *source_object, GError *error = NULL; app->proxy = indicator_messages_application_proxy_new_finish (result, &error); - if (!app) + if (!app->proxy) { - g_warning ("could not create application proxy: %s", error->message); + if (error->code != G_IO_ERROR_CANCELLED) + g_warning ("could not create application proxy: %s", error->message); g_error_free (error); return; } -- cgit v1.2.3 From 12c0fb327dfef1f778de252c715f3b61bfcaea28 Mon Sep 17 00:00:00 2001 From: Lars Uebernickel Date: Fri, 14 Dec 2012 10:59:23 +0100 Subject: im_application_list_set_remote: robuster check for running async operation This fixes the case when app->proxy is still NULL but another application with the same desktop file replaces it. This should never happen in practice, but turned up while testing multiple processes which used the same desktop file. Their proxy_create async functions raced each other because the first one's wasn't properly cancelled. Also fixes a small memory leak. --- src/im-application-list.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/im-application-list.c b/src/im-application-list.c index d3d8dad..959a820 100644 --- a/src/im-application-list.c +++ b/src/im-application-list.c @@ -840,11 +840,17 @@ im_application_list_set_remote (ImApplicationList *list, return; } - if (app->proxy || app->cancellable) + if (app->cancellable) { - g_warning ("replacing '%s' at %s with %s", id, unique_bus_name, - g_dbus_proxy_get_name_owner (G_DBUS_PROXY (app->proxy))); + gchar *name_owner = NULL; + + if (app->proxy) + name_owner = g_dbus_proxy_get_name_owner (G_DBUS_PROXY (app->proxy)); + g_warning ("replacing '%s' at %s with %s", id, name_owner, unique_bus_name); + im_application_list_unset_remote (app); + + g_free (name_owner); } app->cancellable = g_cancellable_new (); -- cgit v1.2.3