aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Uebernickel <lars.uebernickel@canonical.com>2012-12-14 10:59:23 +0100
committerLars Uebernickel <lars.uebernickel@canonical.com>2012-12-14 10:59:23 +0100
commit12c0fb327dfef1f778de252c715f3b61bfcaea28 (patch)
tree48af4fc42a029f13920244e25090f236f0e0302a
parentc46e38d7ab03589a7c7d4fd5fa52ef0bb5f1a9d5 (diff)
downloadayatana-indicator-messages-12c0fb327dfef1f778de252c715f3b61bfcaea28.tar.gz
ayatana-indicator-messages-12c0fb327dfef1f778de252c715f3b61bfcaea28.tar.bz2
ayatana-indicator-messages-12c0fb327dfef1f778de252c715f3b61bfcaea28.zip
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.
-rw-r--r--src/im-application-list.c12
1 files 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 ();