aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-07-06 21:29:33 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-07-08 20:36:14 +0800
commit1e7ad4e03e46b877974b7f73d28dbc737ec9a977 (patch)
tree4c49447a8bb6ffbd94f70838d5c36e465a35b59c
parent0637683a2f89087f49fa0d91e44b04ed26d72ba3 (diff)
downloadgsoc2013-empathy-1e7ad4e03e46b877974b7f73d28dbc737ec9a977.tar
gsoc2013-empathy-1e7ad4e03e46b877974b7f73d28dbc737ec9a977.tar.gz
gsoc2013-empathy-1e7ad4e03e46b877974b7f73d28dbc737ec9a977.tar.bz2
gsoc2013-empathy-1e7ad4e03e46b877974b7f73d28dbc737ec9a977.tar.lz
gsoc2013-empathy-1e7ad4e03e46b877974b7f73d28dbc737ec9a977.tar.xz
gsoc2013-empathy-1e7ad4e03e46b877974b7f73d28dbc737ec9a977.tar.zst
gsoc2013-empathy-1e7ad4e03e46b877974b7f73d28dbc737ec9a977.zip
dispatcher: explicitely keep a ref on accounts in status_changed_handlers
It makes things much cleaner.
-rw-r--r--libempathy/empathy-dispatcher.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/libempathy/empathy-dispatcher.c b/libempathy/empathy-dispatcher.c
index 82ae343c1..30369c849 100644
--- a/libempathy/empathy-dispatcher.c
+++ b/libempathy/empathy-dispatcher.c
@@ -76,7 +76,7 @@ typedef struct
GList *handlers;
GHashTable *request_channel_class_async_ids;
- /* (TpAccount *) => gulong
+ /* reffed (TpAccount *) => gulong
* Signal handler ID of the "status-changed" signal */
GHashTable *status_changed_handlers;
@@ -1054,7 +1054,7 @@ connect_account (EmpathyDispatcher *self,
id = g_signal_connect (account, "status-changed",
G_CALLBACK (dispatcher_status_changed_cb), self);
- g_hash_table_insert (priv->status_changed_handlers, account,
+ g_hash_table_insert (priv->status_changed_handlers, g_object_ref (account),
GUINT_TO_POINTER (id));
}
@@ -1082,6 +1082,8 @@ account_manager_prepared_cb (GObject *source_object,
connect_account (self, a);
}
+
+ g_list_foreach (accounts, (GFunc) g_object_ref, NULL);
g_list_free (accounts);
}
@@ -1142,8 +1144,8 @@ empathy_dispatcher_init (EmpathyDispatcher *self)
priv->request_channel_class_async_ids = g_hash_table_new (g_direct_hash,
g_direct_equal);
- priv->status_changed_handlers = g_hash_table_new (g_direct_hash,
- g_direct_equal);
+ priv->status_changed_handlers = g_hash_table_new_full (NULL, NULL,
+ (GDestroyNotify) g_object_unref, NULL);
priv->dbus = tp_dbus_daemon_dup (NULL);
priv->channel_dispatcher = tp_channel_dispatcher_new (priv->dbus);