aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2009-11-04 00:41:25 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2009-11-04 00:59:08 +0800
commit0e57e53aae124087c0a37afc699a70b40aaba55a (patch)
tree08f94dff86a40ef06b1fd305f153c07c91aa9393
parent691ca3a025341d1ccff5a6058961cd4cdad8d0f1 (diff)
downloadgsoc2013-empathy-0e57e53aae124087c0a37afc699a70b40aaba55a.tar
gsoc2013-empathy-0e57e53aae124087c0a37afc699a70b40aaba55a.tar.gz
gsoc2013-empathy-0e57e53aae124087c0a37afc699a70b40aaba55a.tar.bz2
gsoc2013-empathy-0e57e53aae124087c0a37afc699a70b40aaba55a.tar.lz
gsoc2013-empathy-0e57e53aae124087c0a37afc699a70b40aaba55a.tar.xz
gsoc2013-empathy-0e57e53aae124087c0a37afc699a70b40aaba55a.tar.zst
gsoc2013-empathy-0e57e53aae124087c0a37afc699a70b40aaba55a.zip
empathy-dispatch-operation: ensure that the operation stays alive while tp_channel_call_when_ready is running
-rw-r--r--libempathy/empathy-dispatch-operation.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/libempathy/empathy-dispatch-operation.c b/libempathy/empathy-dispatch-operation.c
index 11ad52302..7eda94d35 100644
--- a/libempathy/empathy-dispatch-operation.c
+++ b/libempathy/empathy-dispatch-operation.c
@@ -196,6 +196,9 @@ dispatcher_operation_got_contact_cb (EmpathyTpContactFactory *factory,
priv->contact = g_object_ref (contact);
g_object_notify (G_OBJECT (self), "contact");
+ /* Ensure to keep the self object alive while the call_when_ready is
+ * running */
+ g_object_ref (self);
tp_channel_call_when_ready (priv->channel,
empathy_dispatch_operation_channel_ready_cb, self);
}
@@ -256,6 +259,7 @@ empathy_dispatch_operation_constructed (GObject *object)
return;
}
+ g_object_ref (self);
tp_channel_call_when_ready (priv->channel,
empathy_dispatch_operation_channel_ready_cb, self);
}
@@ -445,10 +449,14 @@ empathy_dispatch_operation_channel_ready_cb (TpChannel *channel,
/* The error will be handled in empathy_dispatch_operation_invalidated */
if (error != NULL)
- return;
+ goto out;
g_assert (channel == priv->channel);
+ if (priv->status >= EMPATHY_DISPATCHER_OPERATION_STATE_CLAIMED)
+ /* no point to get more information */
+ goto out;
+
/* If the channel wrapper is defined, we assume it's ready */
if (priv->channel_wrapper != NULL)
goto ready;
@@ -464,7 +472,7 @@ empathy_dispatch_operation_channel_ready_cb (TpChannel *channel,
{
priv->ready_handler = g_signal_connect (chat, "notify::ready",
G_CALLBACK (empathy_dispatcher_operation_tp_chat_ready_cb), self);
- return;
+ goto out;
}
}
else if (channel_type == TP_IFACE_QUARK_CHANNEL_TYPE_STREAMED_MEDIA)
@@ -481,6 +489,8 @@ empathy_dispatch_operation_channel_ready_cb (TpChannel *channel,
ready:
empathy_dispatch_operation_set_status (self,
EMPATHY_DISPATCHER_OPERATION_STATE_PENDING);
+out:
+ g_object_unref (self);
}
EmpathyDispatchOperation *