[Telepathy-commits] [telepathy-glib/master] ExampleCallableMediaStream: disconnect from Channel signals when necessary
Simon McVittie
simon.mcvittie at collabora.co.uk
Thu Mar 12 10:15:32 PDT 2009
---
examples/cm/callable/media-stream.c | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/examples/cm/callable/media-stream.c b/examples/cm/callable/media-stream.c
index aa1afbb..605bd04 100644
--- a/examples/cm/callable/media-stream.c
+++ b/examples/cm/callable/media-stream.c
@@ -66,6 +66,7 @@ struct _ExampleCallableMediaStreamPrivate
TpMediaStreamState state;
TpMediaStreamDirection direction;
TpMediaStreamPendingSend pending_send;
+ gulong call_terminated_id;
};
static void
@@ -80,6 +81,8 @@ static void
call_terminated_cb (ExampleCallableMediaChannel *channel,
ExampleCallableMediaStream *self)
{
+ g_signal_handler_disconnect (channel, self->priv->call_terminated_id);
+ self->priv->call_terminated_id = 0;
example_callable_media_stream_close (self);
}
@@ -96,8 +99,8 @@ constructed (GObject *object)
g_object_get (self->priv->channel,
"connection", &self->priv->conn,
NULL);
- g_signal_connect (self->priv->channel, "call-terminated",
- G_CALLBACK (call_terminated_cb), self);
+ self->priv->call_terminated_id = g_signal_connect (self->priv->channel,
+ "call-terminated", G_CALLBACK (call_terminated_cb), self);
if (self->priv->handle != 0)
{
@@ -222,6 +225,13 @@ dispose (GObject *object)
if (self->priv->channel != NULL)
{
+ if (self->priv->call_terminated_id != 0)
+ {
+ g_signal_handler_disconnect (self->priv->channel,
+ self->priv->call_terminated_id);
+ self->priv->call_terminated_id = 0;
+ }
+
g_object_unref (self->priv->channel);
self->priv->channel = NULL;
}
--
1.5.6.5
More information about the telepathy-commits
mailing list