summaryrefslogtreecommitdiff
path: root/telepathy-glib/stream-tube-channel.c
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-10-04 14:38:41 +0200
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-10-04 14:38:43 +0200
commit4190cf0e141f6567e9d679d173c6e759fed93db5 (patch)
treeacb84e08d48a18e8ca1f9469cea98cffec6005ed /telepathy-glib/stream-tube-channel.c
parentb00ef5371809d573bcff3ab18dc519da20b36639 (diff)
downloadtelepathy-glib-4190cf0e141f6567e9d679d173c6e759fed93db5.tar.gz
pass ownership of tubeconn to tp_connection_get_contacts_by_handle()
This ensures that the conn is unrefed even if the callback is not called because of the weak ref.
Diffstat (limited to 'telepathy-glib/stream-tube-channel.c')
-rw-r--r--telepathy-glib/stream-tube-channel.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/telepathy-glib/stream-tube-channel.c b/telepathy-glib/stream-tube-channel.c
index 4a2054850..c1862e6e6 100644
--- a/telepathy-glib/stream-tube-channel.c
+++ b/telepathy-glib/stream-tube-channel.c
@@ -633,22 +633,19 @@ new_local_connection_with_contact (TpConnection *conn,
if (in_error != NULL)
{
DEBUG ("Failed to prepare TpContact: %s", in_error->message);
- goto out;
+ return;
}
if (n_failed > 0)
{
DEBUG ("Failed to prepare TpContact (InvalidHandle)");
- goto out;
+ return;
}
contact = contacts[0];
_tp_stream_tube_connection_set_contact (tube_conn, contact);
complete_accept_operation (self, tube_conn);
-
-out:
- g_object_unref (tube_conn);
}
static void
@@ -671,12 +668,12 @@ new_local_connection_identified (TpStreamTubeChannel *self,
* initiator of the tube */
initiator_handle = tp_channel_get_initiator_handle (TP_CHANNEL (self));
- /* Pass ownership of tube_conn to the callback */
+ /* Pass ownership of tube_conn to the function */
tp_connection_get_contacts_by_handle (
tp_channel_borrow_connection (TP_CHANNEL (self)),
1, &initiator_handle, 0, NULL,
new_local_connection_with_contact,
- tube_conn, NULL, G_OBJECT (self));
+ tube_conn, g_object_unref, G_OBJECT (self));
}
static void
@@ -922,13 +919,13 @@ _new_remote_connection_with_contact (TpConnection *conn,
if (in_error != NULL)
{
DEBUG ("Failed to prepare TpContact: %s", in_error->message);
- goto out;
+ return;
}
if (n_failed > 0)
{
DEBUG ("Failed to prepare TpContact (InvalidHandle)");
- goto out;
+ return;
}
contact = contacts[0];
@@ -941,8 +938,6 @@ _new_remote_connection_with_contact (TpConnection *conn,
g_signal_emit (self, _signals[INCOMING], 0, tube_conn);
/* anyone receiving the signal is required to hold their own reference */
-out:
- g_object_unref (tube_conn);
}
static gboolean
@@ -1037,13 +1032,12 @@ connection_identified (TpStreamTubeChannel *self,
if (can_identify_contact (self))
{
- /* Pass the ref on tube_conn to the callback */
-
+ /* Pass the ref on tube_conn to the function */
tp_connection_get_contacts_by_handle (
tp_channel_borrow_connection (TP_CHANNEL (self)),
1, &handle, 0, NULL,
_new_remote_connection_with_contact,
- tube_conn, NULL, G_OBJECT (self));
+ tube_conn, g_object_unref, G_OBJECT (self));
}
else
{