aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAurelien Gateau <aurelien.gateau@canonical.com>2009-07-27 17:18:41 +0200
committerAurelien Gateau <aurelien.gateau@canonical.com>2009-07-27 17:18:41 +0200
commit8157a2c4c11e6a15b52b100e5c58ba9d6cd48850 (patch)
treec2dda9f2554d818db038079e5d2e2919abff55aa
parent53908231e04a6b04ff07bde18bc737079a83aa4f (diff)
downloadlibayatana-indicator-8157a2c4c11e6a15b52b100e5c58ba9d6cd48850.tar.gz
libayatana-indicator-8157a2c4c11e6a15b52b100e5c58ba9d6cd48850.tar.bz2
libayatana-indicator-8157a2c4c11e6a15b52b100e5c58ba9d6cd48850.zip
Destroy dbus proxies in listener finalize.
Makes it possible to destroy a listener and recreate one without calling the old instance callbacks (useful for unit-tests).
-rw-r--r--libindicate/listener.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/libindicate/listener.c b/libindicate/listener.c
index bd3639d..5a64c81 100644
--- a/libindicate/listener.c
+++ b/libindicate/listener.c
@@ -277,8 +277,19 @@ indicate_listener_init (IndicateListener * listener)
static void
indicate_listener_finalize (GObject * obj)
{
- /* IndicateListener * listener = INDICATE_LISTENER(obj); */
-
+ IndicateListener * listener = INDICATE_LISTENER(obj);
+ IndicateListenerPrivate * priv = INDICATE_LISTENER_GET_PRIVATE(listener);
+
+ if (priv->todo_idle != 0) {
+ g_idle_remove_by_data(obj);
+ }
+ /* Hack: proxy_struct_destroy() lacks a user_data parameter, but since the
+ * caller is responsible for handling params on the stack, it works
+ */
+ g_list_foreach(priv->proxies_possible, (GFunc)proxy_struct_destroy, NULL);
+ g_list_free(priv->proxies_possible);
+ g_list_foreach(priv->proxies_working, (GFunc)proxy_struct_destroy, NULL);
+ g_list_free(priv->proxies_working);
G_OBJECT_CLASS (indicate_listener_parent_class)->finalize (obj);
return;
}