From 46c8b3fee8172b80d0b0ee87887e4b3375c6f659 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 8 Jul 2010 12:23:14 -0500 Subject: Disconnecting signal before removing from hashtable so we don't try twice. --- libindicator/indicator-service.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libindicator/indicator-service.c b/libindicator/indicator-service.c index 15335f3..c29456e 100644 --- a/libindicator/indicator-service.c +++ b/libindicator/indicator-service.c @@ -453,6 +453,7 @@ unwatch_core (IndicatorService * service, const gchar * name) gpointer watcher_item = g_hash_table_lookup(priv->watchers, name); if (watcher_item != NULL) { /* Free the watcher */ + g_signal_handlers_disconnect_by_func(G_OBJECT(watcher_item), G_CALLBACK(proxy_destroyed), service); g_hash_table_remove(priv->watchers, name); } else { /* Odd that we couldn't find the person, but, eh */ -- cgit v1.2.3 From 974328f02da5a9c37f3f1e42db5794eb88c5e8ba Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 8 Jul 2010 12:31:56 -0500 Subject: Unreffing the objects in dispose and ensuring we disconnect the signals first. --- libindicator/indicator-service.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/libindicator/indicator-service.c b/libindicator/indicator-service.c index c29456e..a2aea24 100644 --- a/libindicator/indicator-service.c +++ b/libindicator/indicator-service.c @@ -30,6 +30,8 @@ License along with this library. If not, see #include "indicator-service.h" static void unwatch_core (IndicatorService * service, const gchar * name); +static void proxy_destroyed (GObject * proxy, gpointer user_data); +static gboolean watchers_remove (gpointer key, gpointer value, gpointer user_data); /* DBus Prototypes */ static gboolean _indicator_service_server_watch (IndicatorService * service, DBusGMethodInvocation * method); static gboolean _indicator_service_server_un_watch (IndicatorService * service, DBusGMethodInvocation * method); @@ -209,6 +211,10 @@ indicator_service_dispose (GObject *object) { IndicatorServicePrivate * priv = INDICATOR_SERVICE_GET_PRIVATE(object); + if (priv->watchers != NULL) { + g_hash_table_foreach_remove(priv->watchers, watchers_remove, object); + } + if (priv->dbus_proxy != NULL) { g_object_unref(G_OBJECT(priv->dbus_proxy)); priv->dbus_proxy = NULL; @@ -314,6 +320,15 @@ get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspe return; } +/* A function to remove the signals on a proxy before we destroy + it because in this case we've stopped caring. */ +static gboolean +watchers_remove (gpointer key, gpointer value, gpointer user_data) +{ + g_signal_handlers_disconnect_by_func(G_OBJECT(value), G_CALLBACK(proxy_destroyed), user_data); + return TRUE; +} + /* This is the function that gets executed if we timeout because there are no watchers. We sent the shutdown signal and hope someone does something sane with it. */ -- cgit v1.2.3 From 647f8ea91cc304a0b14a255fcd07560046735eac Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 8 Jul 2010 12:34:24 -0500 Subject: Use the same function so we know everything is all right. --- libindicator/indicator-service.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libindicator/indicator-service.c b/libindicator/indicator-service.c index a2aea24..7c5826e 100644 --- a/libindicator/indicator-service.c +++ b/libindicator/indicator-service.c @@ -468,7 +468,7 @@ unwatch_core (IndicatorService * service, const gchar * name) gpointer watcher_item = g_hash_table_lookup(priv->watchers, name); if (watcher_item != NULL) { /* Free the watcher */ - g_signal_handlers_disconnect_by_func(G_OBJECT(watcher_item), G_CALLBACK(proxy_destroyed), service); + watchers_remove((gpointer)name, watcher_item, service); g_hash_table_remove(priv->watchers, name); } else { /* Odd that we couldn't find the person, but, eh */ -- cgit v1.2.3 From 7412490502f6f249479c1f4d7e07ab868530dcd0 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 8 Jul 2010 12:36:50 -0500 Subject: Documenting the choices of not having a nice callback func. --- libindicator/indicator-service.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libindicator/indicator-service.c b/libindicator/indicator-service.c index 7c5826e..db234e2 100644 --- a/libindicator/indicator-service.c +++ b/libindicator/indicator-service.c @@ -165,6 +165,10 @@ indicator_service_init (IndicatorService *self) priv->bus = NULL; priv->this_service_version = 0; + /* NOTE: We're using g_object_unref here because that's what needs to + happen, but you really should call watchers_remove first as well + since that disconnects the signals. We can't do that with a callback + here because there is no user data to pass the object as well. */ priv->watchers = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_object_unref); /* Start talkin' dbus */ -- cgit v1.2.3 From bc5e925ed181f2b64229afcac41bb4ba4f9aa4d1 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 8 Jul 2010 15:12:12 -0500 Subject: 0.3.9 --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 8ae0c74..2622d73 100644 --- a/configure.ac +++ b/configure.ac @@ -1,10 +1,10 @@ -AC_INIT(libindicator, 0.3.8, ted@canonical.com) +AC_INIT(libindicator, 0.3.9, ted@canonical.com) AC_PREREQ(2.53) AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(libindicator, 0.3.8) +AM_INIT_AUTOMAKE(libindicator, 0.3.9) AM_MAINTAINER_MODE m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES]) -- cgit v1.2.3