aboutsummaryrefslogtreecommitdiff
path: root/libindicator
diff options
context:
space:
mode:
Diffstat (limited to 'libindicator')
-rw-r--r--libindicator/Makefile.in5
-rw-r--r--libindicator/indicator-service.c20
2 files changed, 24 insertions, 1 deletions
diff --git a/libindicator/Makefile.in b/libindicator/Makefile.in
index ebe7648..9d5a624 100644
--- a/libindicator/Makefile.in
+++ b/libindicator/Makefile.in
@@ -57,7 +57,10 @@ DIST_COMMON = $(libindicatorinclude_HEADERS) $(srcdir)/Makefile.am \
$(top_srcdir)/Makefile.am.marshal
subdir = libindicator
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
+ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
+ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
diff --git a/libindicator/indicator-service.c b/libindicator/indicator-service.c
index 15335f3..db234e2 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);
@@ -163,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 */
@@ -209,6 +215,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 +324,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. */
@@ -453,6 +472,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 */
+ 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 */