aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-07-08 12:31:56 -0500
committerTed Gould <ted@gould.cx>2010-07-08 12:31:56 -0500
commit974328f02da5a9c37f3f1e42db5794eb88c5e8ba (patch)
treed4c8c4bb1c505da95287c7976193af05aedad670
parent46c8b3fee8172b80d0b0ee87887e4b3375c6f659 (diff)
downloadlibayatana-indicator-974328f02da5a9c37f3f1e42db5794eb88c5e8ba.tar.gz
libayatana-indicator-974328f02da5a9c37f3f1e42db5794eb88c5e8ba.tar.bz2
libayatana-indicator-974328f02da5a9c37f3f1e42db5794eb88c5e8ba.zip
Unreffing the objects in dispose and ensuring we disconnect the signals first.
-rw-r--r--libindicator/indicator-service.c15
1 files changed, 15 insertions, 0 deletions
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. */