[telepathy-gabble/master] Explicitely tear down the muc channel
Sjoerd Simons
sjoerd.simons at collabora.co.uk
Tue Jan 5 10:13:21 PST 2010
A MucChannel owns the Tubes channel associated with it. The tubes channel uses
a tp_external_group_mixin, with the MucChannel being the external. Which means
there is a reference counting loop that must be explicitely broken.
---
src/muc-channel.c | 8 ++++++++
src/muc-channel.h | 1 +
src/muc-factory.c | 8 ++++++++
3 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/src/muc-channel.c b/src/muc-channel.c
index 1606620..c0e3e7e 100644
--- a/src/muc-channel.c
+++ b/src/muc-channel.c
@@ -1419,6 +1419,8 @@ close_channel (GabbleMucChannel *chan, const gchar *reason,
TpIntSet *set;
GArray *handles;
+ DEBUG ("Closing");
+
g_assert (GABBLE_IS_MUC_CHANNEL (chan));
priv = GABBLE_MUC_CHANNEL_GET_PRIVATE (chan);
@@ -3689,6 +3691,12 @@ gabble_muc_channel_close_tube (GabbleMucChannel *gmuc)
}
}
+void
+gabble_muc_channel_teardown (GabbleMucChannel *gmuc)
+{
+ close_channel (gmuc, NULL, FALSE, 0, 0);
+}
+
static void
channel_iface_init (gpointer g_iface, gpointer iface_data)
{
diff --git a/src/muc-channel.h b/src/muc-channel.h
index a7e5ce3..454fe7e 100644
--- a/src/muc-channel.h
+++ b/src/muc-channel.h
@@ -112,6 +112,7 @@ gabble_muc_channel_open_tube (GabbleMucChannel *gmuc,
TpHandle initiator,
gboolean requested);
+void gabble_muc_channel_teardown (GabbleMucChannel *gmuc);
void gabble_muc_channel_close_tube (GabbleMucChannel *gmuc);
diff --git a/src/muc-factory.c b/src/muc-factory.c
index 93c6e00..5fc7b21 100644
--- a/src/muc-factory.c
+++ b/src/muc-factory.c
@@ -853,7 +853,15 @@ gabble_muc_factory_close_all (GabbleMucFactory *self)
if (priv->text_channels != NULL)
{
GHashTable *tmp = priv->text_channels;
+ GHashTableIter iter;
+ gpointer chan;
+
priv->text_channels = NULL;
+
+ g_hash_table_iter_init (&iter, tmp);
+ while (g_hash_table_iter_next (&iter, NULL, &chan))
+ gabble_muc_channel_teardown (GABBLE_MUC_CHANNEL (chan));
+
g_hash_table_destroy (tmp);
}
--
1.5.6.5
More information about the telepathy-commits
mailing list