aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy/empathy-dispatcher.c
diff options
context:
space:
mode:
authorMike Ruprecht <mike.ruprecht@collabora.co.uk>2009-10-15 05:59:04 +0800
committerMike Ruprecht <mike.ruprecht@collabora.co.uk>2009-10-15 05:59:04 +0800
commit21236da0d1d89af62dd4e11e883b553af658f41a (patch)
tree21fd71196fb69b7bd2992ff4599a077f28a5894e /libempathy/empathy-dispatcher.c
parenteeafe98a27dbccc08a6023b7c73f7bd537c5e39c (diff)
downloadgsoc2013-empathy-21236da0d1d89af62dd4e11e883b553af658f41a.tar
gsoc2013-empathy-21236da0d1d89af62dd4e11e883b553af658f41a.tar.gz
gsoc2013-empathy-21236da0d1d89af62dd4e11e883b553af658f41a.tar.bz2
gsoc2013-empathy-21236da0d1d89af62dd4e11e883b553af658f41a.tar.lz
gsoc2013-empathy-21236da0d1d89af62dd4e11e883b553af658f41a.tar.xz
gsoc2013-empathy-21236da0d1d89af62dd4e11e883b553af658f41a.tar.zst
gsoc2013-empathy-21236da0d1d89af62dd4e11e883b553af658f41a.zip
Move destruction of connections from finalize to dispose.
Code can potentially be run between the dispose and finalize methods. This moves the destruction of connections and subsequently outstanding_requests into the dispose function so the request callback can't be fired between unreffing the EmpathyDispatcher and cancelling the pending request.
Diffstat (limited to 'libempathy/empathy-dispatcher.c')
-rw-r--r--libempathy/empathy-dispatcher.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/libempathy/empathy-dispatcher.c b/libempathy/empathy-dispatcher.c
index 55f2e7579..cc0c8198b 100644
--- a/libempathy/empathy-dispatcher.c
+++ b/libempathy/empathy-dispatcher.c
@@ -944,6 +944,8 @@ static void
dispatcher_dispose (GObject *object)
{
EmpathyDispatcherPriv *priv = GET_PRIV (object);
+ GHashTableIter iter;
+ gpointer connection;
GList *l;
if (priv->dispose_has_run)
@@ -961,6 +963,16 @@ dispatcher_dispose (GObject *object)
g_object_unref (priv->handler);
priv->handler = NULL;
+ g_hash_table_iter_init (&iter, priv->connections);
+ while (g_hash_table_iter_next (&iter, &connection, NULL))
+ {
+ g_signal_handlers_disconnect_by_func (connection,
+ dispatcher_connection_invalidated_cb, object);
+ }
+
+ g_hash_table_destroy (priv->connections);
+ priv->connections = NULL;
+
G_OBJECT_CLASS (empathy_dispatcher_parent_class)->dispose (object);
}
@@ -991,13 +1003,6 @@ dispatcher_finalize (GObject *object)
g_list_free (priv->channels);
- g_hash_table_iter_init (&iter, priv->connections);
- while (g_hash_table_iter_next (&iter, &connection, NULL))
- {
- g_signal_handlers_disconnect_by_func (connection,
- dispatcher_connection_invalidated_cb, object);
- }
-
g_hash_table_iter_init (&iter, priv->outstanding_classes_requests);
while (g_hash_table_iter_next (&iter, &connection, (gpointer *) &list))
{
@@ -1007,7 +1012,6 @@ dispatcher_finalize (GObject *object)
g_object_unref (priv->account_manager);
- g_hash_table_destroy (priv->connections);
g_hash_table_destroy (priv->outstanding_classes_requests);
}