From 6a1c35a64e0dba477bd654d682f1e90c95361f78 Mon Sep 17 00:00:00 2001 From: Michael Terry Date: Fri, 25 Feb 2011 08:45:31 -0500 Subject: fix crash on null string passed to GVariant --- src/application-service-appstore.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c index 10feef5..5f343e5 100644 --- a/src/application-service-appstore.c +++ b/src/application-service-appstore.c @@ -1238,9 +1238,10 @@ get_applications (ApplicationServiceAppstore * appstore) } g_variant_builder_add (&builder, "(sisossss)", app->icon, - position++, app->dbus_name, app->menu, - app->icon_theme_path, app->label, - app->guide, app->icon_desc); + position++, app->dbus_name, app->menu, + app->icon_theme_path, app->label, + app->guide, + (app->icon_desc != NULL) ? app->icon_desc : ""); } out = g_variant_builder_end(&builder); -- cgit v1.2.3 From c6313acb0861e4861a160f6866e42995cd50f062 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 11 Mar 2011 14:50:18 -0600 Subject: Add a cancellable object for the GetApplications call --- src/indicator-application.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/src/indicator-application.c b/src/indicator-application.c index f7ce391..1d074d6 100644 --- a/src/indicator-application.c +++ b/src/indicator-application.c @@ -86,6 +86,7 @@ struct _IndicatorApplicationPrivate { GList * applications; GHashTable * theme_dirs; guint disconnect_kill; + GCancellable * get_apps_cancel; }; typedef struct _ApplicationEntry ApplicationEntry; @@ -166,6 +167,8 @@ indicator_application_init (IndicatorApplication *self) priv->theme_dirs = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); + priv->get_apps_cancel = NULL; + return; } @@ -178,6 +181,12 @@ indicator_application_dispose (GObject *object) g_source_remove(priv->disconnect_kill); } + if (priv->get_apps_cancel != NULL) { + g_cancellable_cancel(priv->get_apps_cancel); + /* The callback should clear the cancelable */ + g_warn_if_fail(priv->get_apps_cancel == NULL); + } + while (priv->applications != NULL) { application_removed(INDICATOR_APPLICATION(object), 0); @@ -290,10 +299,20 @@ service_proxy_cb (GObject * object, GAsyncResult * res, gpointer user_data) g_signal_connect(proxy, "g-signal", G_CALLBACK(receive_signal), self); + /* We shouldn't be in a situation where we've already + called this function. It doesn't *hurt* anything, but + man we should look into it more. */ + if (priv->get_apps_cancel != NULL) { + g_warning("Already getting applications? Odd."); + return; + } + + priv->get_apps_cancel = g_cancellable_new(); + /* Query it for existing applications */ g_debug("Request current apps"); g_dbus_proxy_call(priv->service_proxy, "GetApplications", NULL, - G_DBUS_CALL_FLAGS_NONE, -1, NULL, + G_DBUS_CALL_FLAGS_NONE, -1, priv->get_apps_cancel, get_applications, self); return; @@ -789,6 +808,12 @@ get_applications (GObject * obj, GAsyncResult * res, gpointer user_data) GVariant * child; GVariantIter * iter; + /* No one can cancel us anymore, we've completed! */ + if (priv->get_apps_cancel != NULL) { + g_object_unref(priv->get_apps_cancel); + priv->get_apps_cancel = NULL; + } + result = g_dbus_proxy_call_finish(priv->service_proxy, res, &error); if (error != NULL) { -- cgit v1.2.3 From a4e9c0bf6ee2b628dac8655cacd2841c87aae702 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 11 Mar 2011 15:42:22 -0600 Subject: If we're in the middle of a GetApplications and we get another signal, let's try again. --- src/indicator-application.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/indicator-application.c b/src/indicator-application.c index 1d074d6..73e8341 100644 --- a/src/indicator-application.c +++ b/src/indicator-application.c @@ -749,6 +749,21 @@ receive_signal (GDBusProxy * proxy, gchar * sender_name, gchar * signal_name, GVariant * parameters, gpointer user_data) { IndicatorApplication * self = INDICATOR_APPLICATION(user_data); + IndicatorApplicationPrivate * priv = INDICATOR_APPLICATION_GET_PRIVATE(self); + + /* If we're in the middle of a GetApplications call and we get + any of these our state is probably going to just be confused. Let's + cancel the call we had and try again to try and get a clear answer */ + if (priv->get_apps_cancel != NULL) { + g_cancelable_cancel(priv->get_apps_cancel); + g_object_unref(priv->get_apps_cancel); + + priv->get_apps_cancel = g_cancellable_new(); + + g_dbus_proxy_call(priv->service_proxy, "GetApplications", NULL, + G_DBUS_CALL_FLAGS_NONE, -1, priv->get_apps_cancel, + get_applications, self); + } if (g_strcmp0(signal_name, "ApplicationAdded") == 0) { const gchar * iconname; -- cgit v1.2.3 From bc6a7d9b4fd1dd9edc477edfdba39a34069ec53d Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 11 Mar 2011 15:43:47 -0600 Subject: Unrefing the object, it might not happen right away, so let's clear it ourselves. --- src/indicator-application.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/indicator-application.c b/src/indicator-application.c index 73e8341..c2dd16a 100644 --- a/src/indicator-application.c +++ b/src/indicator-application.c @@ -183,8 +183,8 @@ indicator_application_dispose (GObject *object) if (priv->get_apps_cancel != NULL) { g_cancellable_cancel(priv->get_apps_cancel); - /* The callback should clear the cancelable */ - g_warn_if_fail(priv->get_apps_cancel == NULL); + g_object_unref(priv->get_apps_cancel); + priv->get_apps_cancel = NULL; } while (priv->applications != NULL) { @@ -755,7 +755,7 @@ receive_signal (GDBusProxy * proxy, gchar * sender_name, gchar * signal_name, any of these our state is probably going to just be confused. Let's cancel the call we had and try again to try and get a clear answer */ if (priv->get_apps_cancel != NULL) { - g_cancelable_cancel(priv->get_apps_cancel); + g_cancellable_cancel(priv->get_apps_cancel); g_object_unref(priv->get_apps_cancel); priv->get_apps_cancel = g_cancellable_new(); -- cgit v1.2.3 From c892f84845aeb7367c9246a679a21da09ebafd2c Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 11 Mar 2011 15:49:21 -0600 Subject: Only clear the cancel if we're not being cancelled --- src/indicator-application.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/indicator-application.c b/src/indicator-application.c index c2dd16a..f9b200b 100644 --- a/src/indicator-application.c +++ b/src/indicator-application.c @@ -823,14 +823,16 @@ get_applications (GObject * obj, GAsyncResult * res, gpointer user_data) GVariant * child; GVariantIter * iter; + result = g_dbus_proxy_call_finish(priv->service_proxy, res, &error); + /* No one can cancel us anymore, we've completed! */ if (priv->get_apps_cancel != NULL) { - g_object_unref(priv->get_apps_cancel); - priv->get_apps_cancel = NULL; + if (error == NULL || error->domain != G_IO_ERROR || error->code != G_IO_ERROR_CANCELLED) { + g_object_unref(priv->get_apps_cancel); + priv->get_apps_cancel = NULL; + } } - result = g_dbus_proxy_call_finish(priv->service_proxy, res, &error); - if (error != NULL) { g_warning("Unable to get application list: %s", error->message); return; -- cgit v1.2.3 From d3c5e2540937720b15b542092cfccf924c7487aa Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 11 Mar 2011 15:53:30 -0600 Subject: A couple memory leaks --- src/indicator-application.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/indicator-application.c b/src/indicator-application.c index f9b200b..eabbf54 100644 --- a/src/indicator-application.c +++ b/src/indicator-application.c @@ -835,13 +835,17 @@ get_applications (GObject * obj, GAsyncResult * res, gpointer user_data) if (error != NULL) { g_warning("Unable to get application list: %s", error->message); + g_error_free(error); return; } g_variant_get(result, "(a(sisossss))", &iter); - while ((child = g_variant_iter_next_value (iter))) + while ((child = g_variant_iter_next_value (iter))) { get_applications_helper(self, child); + g_variant_unref(child); + } g_variant_iter_free (iter); + g_variant_unref(result); return; } -- cgit v1.2.3 From a11d8f16f4939353926b3cbf35217746fb488803 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 11 Mar 2011 16:19:02 -0600 Subject: Removing applications before adding new ones. --- src/indicator-application.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/indicator-application.c b/src/indicator-application.c index eabbf54..f59ffd7 100644 --- a/src/indicator-application.c +++ b/src/indicator-application.c @@ -833,12 +833,20 @@ get_applications (GObject * obj, GAsyncResult * res, gpointer user_data) } } + /* If we got an error, print it and exit out */ if (error != NULL) { g_warning("Unable to get application list: %s", error->message); g_error_free(error); return; } + /* Remove all applications that we previously had + as we're going to repopulate the list. */ + while (priv->applications != NULL) { + application_removed(self, 0); + } + + /* Get our new applications that we got in the request */ g_variant_get(result, "(a(sisossss))", &iter); while ((child = g_variant_iter_next_value (iter))) { get_applications_helper(self, child); -- cgit v1.2.3 From 00a8865d92f45049e9f2485ff6825506a2561197 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 11 Mar 2011 16:28:20 -0600 Subject: If we're requeuing we don't really want to continue to process the signal --- src/indicator-application.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/indicator-application.c b/src/indicator-application.c index f59ffd7..2b26c92 100644 --- a/src/indicator-application.c +++ b/src/indicator-application.c @@ -763,6 +763,7 @@ receive_signal (GDBusProxy * proxy, gchar * sender_name, gchar * signal_name, g_dbus_proxy_call(priv->service_proxy, "GetApplications", NULL, G_DBUS_CALL_FLAGS_NONE, -1, priv->get_apps_cancel, get_applications, self); + return; } if (g_strcmp0(signal_name, "ApplicationAdded") == 0) { -- cgit v1.2.3 -- cgit v1.2.3 From e2adde1fc915569e88152391fda8b0244b095ee2 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 14 Mar 2011 14:09:36 -0500 Subject: Noticing a missing unref --- src/application-service-appstore.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c index 5f343e5..faf6dc0 100644 --- a/src/application-service-appstore.c +++ b/src/application-service-appstore.c @@ -486,6 +486,7 @@ got_all_properties (GObject * source_object, GAsyncResult * res, } /* else ignore */ } g_variant_iter_free (iter); + g_variant_unref(properties); if (menu == NULL || id == NULL || category == NULL || status == NULL || icon_name == NULL) { -- cgit v1.2.3 From e5d2b6bd554e9dbc790c8b72463e48c1deeee70c Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 14 Mar 2011 14:19:10 -0500 Subject: Do a sort after deciding the ordering ID --- src/application-service-appstore.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c index faf6dc0..43d9e23 100644 --- a/src/application-service-appstore.c +++ b/src/application-service-appstore.c @@ -525,6 +525,7 @@ got_all_properties (GObject * source_object, GAsyncResult * res, app->ordering_index = GPOINTER_TO_UINT(ordering_index_over); } g_debug("'%s' ordering index is '%X'", app->id, app->ordering_index); + app->appstore->priv->applications = g_list_sort_with_data(app->appstore->priv->applications, app_sort_func, NULL); if (label != NULL) { app->label = g_variant_dup_string(label, NULL); -- cgit v1.2.3 From 31299f3d0b47b350057886b90094e9b5552c6b69 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 14 Mar 2011 14:33:22 -0500 Subject: Debug message on missing override file. --- src/application-service-appstore.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c index 43d9e23..b0f4a0c 100644 --- a/src/application-service-appstore.c +++ b/src/application-service-appstore.c @@ -374,6 +374,7 @@ load_override_file (GHashTable * hash, const gchar * filename) g_return_if_fail(filename != NULL); if (!g_file_test(filename, G_FILE_TEST_EXISTS)) { + g_debug("Override file '%s' doesn't exist"); return; } -- cgit v1.2.3 From b29c6f2c3243a688a3962ccf10d657f97bb08983 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 14 Mar 2011 14:33:49 -0500 Subject: Debug message on missing override file. --- src/application-service-appstore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c index b0f4a0c..91fd226 100644 --- a/src/application-service-appstore.c +++ b/src/application-service-appstore.c @@ -374,7 +374,7 @@ load_override_file (GHashTable * hash, const gchar * filename) g_return_if_fail(filename != NULL); if (!g_file_test(filename, G_FILE_TEST_EXISTS)) { - g_debug("Override file '%s' doesn't exist"); + g_debug("Override file '%s' doesn't exist", filename); return; } -- cgit v1.2.3 From b0e008bd034e8ab4c638aedd6715f25211498845 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 14 Mar 2011 14:44:30 -0500 Subject: Inserting network manager applet at the front --- data/ordering-override.keyfile | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/data/ordering-override.keyfile b/data/ordering-override.keyfile index 71d7c1a..98ee36e 100644 --- a/data/ordering-override.keyfile +++ b/data/ordering-override.keyfile @@ -1,5 +1,6 @@ [Ordering Index Overrides] -gnome-power-manager=1 -gst-keyboard-xkb=2 -gsd-keyboard-xkb=3 -ibus=4 +nm_applet=1 +gnome-power-manager=2 +gst-keyboard-xkb=3 +gsd-keyboard-xkb=4 +ibus=5 -- cgit v1.2.3 From 1aeeeb0355a59efe470e798806f6814ae19f0c9a Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 14 Mar 2011 16:41:39 -0500 Subject: Use the passed in proxy to get the result to ensure it's valid. --- src/application-service-appstore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c index 5f343e5..77f0634 100644 --- a/src/application-service-appstore.c +++ b/src/application-service-appstore.c @@ -438,7 +438,7 @@ got_all_properties (GObject * source_object, GAsyncResult * res, * icon_theme_path = NULL, * index = NULL, * label = NULL, * guide = NULL; - GVariant * properties = g_dbus_proxy_call_finish(app->props, res, &error); + GVariant * properties = g_dbus_proxy_call_finish(G_DBUS_PROXY(source_object), res, &error); if (app->props_cancel != NULL) { g_object_unref(app->props_cancel); -- cgit v1.2.3 From 9e0c4a202815159488030a7d6ce65a39303d8f0e Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 16 Mar 2011 09:58:05 -0500 Subject: Moving iBus and keyboard under advice of mpt --- data/ordering-override.keyfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/data/ordering-override.keyfile b/data/ordering-override.keyfile index 98ee36e..7adef0c 100644 --- a/data/ordering-override.keyfile +++ b/data/ordering-override.keyfile @@ -1,6 +1,6 @@ [Ordering Index Overrides] nm_applet=1 gnome-power-manager=2 -gst-keyboard-xkb=3 -gsd-keyboard-xkb=4 -ibus=5 +ibus=3 +gst-keyboard-xkb=4 +gsd-keyboard-xkb=5 -- cgit v1.2.3 From 449299038368f8814050aa2fa2256657ff050f17 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 16 Mar 2011 14:41:43 -0500 Subject: 0.2.95 --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index fe010cd..67983a5 100644 --- a/configure.ac +++ b/configure.ac @@ -1,11 +1,11 @@ -AC_INIT(indicator-application, 0.2.94, ted@canonical.com) +AC_INIT(indicator-application, 0.2.95, ted@canonical.com) AC_COPYRIGHT([Copyright 2009, 2010 Canonical]) AC_PREREQ(2.53) AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(indicator-application, 0.2.94) +AM_INIT_AUTOMAKE(indicator-application, 0.2.95) AM_MAINTAINER_MODE -- cgit v1.2.3 From c98c03e09896179829a9906e30b90f11adc21d07 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 16 Mar 2011 14:49:53 -0500 Subject: Drop debian/patches/fix-null-string-to-variant-crash.patch --- debian/changelog | 3 ++- debian/patches/fix-null-string-to-variant-crash.patch | 19 ------------------- debian/patches/series | 1 - 3 files changed, 2 insertions(+), 21 deletions(-) delete mode 100644 debian/patches/fix-null-string-to-variant-crash.patch delete mode 100644 debian/patches/series diff --git a/debian/changelog b/debian/changelog index 7cc4d91..1f56fea 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,8 +5,9 @@ indicator-application (0.2.95-0ubuntu1~ppa1) UNRELEASED; urgency=low ∘ No more duplication of indicators on the panel (LP: #708243) ∘ Using proper object on async call (LP: #734584) ∘ Protect from the accessible description being NULL. (LP: #724767) + * Drop debian/patches/fix-null-string-to-variant-crash.patch - -- Ted Gould Wed, 16 Mar 2011 14:47:38 -0500 + -- Ted Gould Wed, 16 Mar 2011 14:49:34 -0500 indicator-application (0.2.94-0ubuntu2) natty; urgency=low diff --git a/debian/patches/fix-null-string-to-variant-crash.patch b/debian/patches/fix-null-string-to-variant-crash.patch deleted file mode 100644 index ebcad4c..0000000 --- a/debian/patches/fix-null-string-to-variant-crash.patch +++ /dev/null @@ -1,19 +0,0 @@ -=== modified file 'src/application-service-appstore.c' -Index: indicator-application.ubu/src/application-service-appstore.c -=================================================================== ---- indicator-application.ubu.orig/src/application-service-appstore.c 2011-02-25 08:50:32.170749000 -0500 -+++ indicator-application.ubu/src/application-service-appstore.c 2011-02-25 08:53:26.313552982 -0500 -@@ -1238,9 +1238,10 @@ - } - - g_variant_builder_add (&builder, "(sisossss)", app->icon, -- position++, app->dbus_name, app->menu, -- app->icon_theme_path, app->label, -- app->guide, app->icon_desc); -+ position++, app->dbus_name, app->menu, -+ app->icon_theme_path, app->label, -+ app->guide, -+ (app->icon_desc != NULL) ? app->icon_desc : ""); - } - - out = g_variant_builder_end(&builder); diff --git a/debian/patches/series b/debian/patches/series deleted file mode 100644 index 8d2cb6b..0000000 --- a/debian/patches/series +++ /dev/null @@ -1 +0,0 @@ -fix-null-string-to-variant-crash.patch -- cgit v1.2.3 From 1058de265dd08b2c3e8dd1c9dff9a21dee40e787 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 16 Mar 2011 14:50:40 -0500 Subject: releasing version 0.2.95-0ubuntu1~ppa1 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 1f56fea..c7639aa 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -indicator-application (0.2.95-0ubuntu1~ppa1) UNRELEASED; urgency=low +indicator-application (0.2.95-0ubuntu1~ppa1) natty; urgency=low * New upstream release. ∘ Fix ordering of indicators @@ -7,7 +7,7 @@ indicator-application (0.2.95-0ubuntu1~ppa1) UNRELEASED; urgency=low ∘ Protect from the accessible description being NULL. (LP: #724767) * Drop debian/patches/fix-null-string-to-variant-crash.patch - -- Ted Gould Wed, 16 Mar 2011 14:49:34 -0500 + -- Ted Gould Wed, 16 Mar 2011 14:50:37 -0500 indicator-application (0.2.94-0ubuntu2) natty; urgency=low -- cgit v1.2.3