aboutsummaryrefslogtreecommitdiff
path: root/libindicator/indicator-service.c
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2011-07-14 13:08:31 -0500
committerTed Gould <ted@gould.cx>2011-07-14 13:08:31 -0500
commita6ea4762672c64f788778f6ee79d73be40587984 (patch)
treec4dc9cec5414b0489f22704f0404fd362f204af1 /libindicator/indicator-service.c
parent445e65a17e0d8ee0056bf0812bb75961f053c5ec (diff)
parent64c3e2e2ba1ddcaac62e6ec50f414abd51e6b3d9 (diff)
downloadlibayatana-indicator-a6ea4762672c64f788778f6ee79d73be40587984.tar.gz
libayatana-indicator-a6ea4762672c64f788778f6ee79d73be40587984.tar.bz2
libayatana-indicator-a6ea4762672c64f788778f6ee79d73be40587984.zip
Fixing the libindicator test suite
Diffstat (limited to 'libindicator/indicator-service.c')
-rw-r--r--libindicator/indicator-service.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/libindicator/indicator-service.c b/libindicator/indicator-service.c
index d7ab375..e9f3133 100644
--- a/libindicator/indicator-service.c
+++ b/libindicator/indicator-service.c
@@ -32,7 +32,7 @@ License along with this library. If not, see
#include "dbus-shared.h"
static void unwatch_core (IndicatorService * service, const gchar * name);
-static gboolean watchers_remove (gpointer key, gpointer value, gpointer user_data);
+static void watchers_remove (gpointer value);
static void bus_get_cb (GObject * object, GAsyncResult * res, gpointer user_data);
static GVariant * bus_watch (IndicatorService * service, const gchar * sender);
@@ -211,10 +211,9 @@ indicator_service_init (IndicatorService *self)
}
/* NOTE: We're using g_free 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, NULL);
+ happen and we're watchers_remove as well to clean up the dbus
+ watches we've setup. */
+ priv->watchers = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, watchers_remove);
priv->bus_cancel = g_cancellable_new();
g_bus_get(G_BUS_TYPE_SESSION,
@@ -233,7 +232,8 @@ 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);
+ g_hash_table_destroy(priv->watchers);
+ priv->watchers = NULL;
}
if (priv->timeout != 0) {
@@ -417,11 +417,11 @@ bus_method_call (GDBusConnection * connection, const gchar * sender, const gchar
/* 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)
+static void
+watchers_remove (gpointer value)
{
g_bus_unwatch_name(GPOINTER_TO_UINT(value));
- return TRUE;
+ return;
}
/* This is the function that gets executed if we timeout
@@ -588,8 +588,6 @@ unwatch_core (IndicatorService * service, const gchar * name)
/* Remove us from the watcher list here */
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 */