summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJonathon Jongsma <jonathon.jongsma@collabora.co.uk>2009-01-29 11:54:24 -0600
committerWill Thompson <will.thompson@collabora.co.uk>2012-04-08 09:42:43 +0100
commit5ebe6a7cf1fac6df992cb65ca18cdabf8ece20be (patch)
tree60bdedecd6e8809f98b29766dcac6f2212df7367 /src
parent2e852a3bb80afc785174734cf1c877ffc918df88 (diff)
Fix the crash on closing the RoomList channel
The Act of unreffing the Channel emitted the 'closed' signal, and we were connecting to the closed signal and and unreffing the channel again in the handler. It is necessary to unref the channel in response to the 'closed' signal in order to handle the dbus Close() method, so we store the channel in a temporary variable and then NULL out the priv->channel variable before unreffing so that we don't unref again in the closed handler
Diffstat (limited to 'src')
-rw-r--r--src/idle-roomlist-channel.c8
-rw-r--r--src/idle-roomlist-manager.c10
2 files changed, 9 insertions, 9 deletions
diff --git a/src/idle-roomlist-channel.c b/src/idle-roomlist-channel.c
index 781e25b..13d3fe2 100644
--- a/src/idle-roomlist-channel.c
+++ b/src/idle-roomlist-channel.c
@@ -364,17 +364,11 @@ idle_roomlist_channel_close (TpSvcChannel *iface,
DBusGMethodInvocation *context)
{
IdleRoomlistChannel *obj = IDLE_ROOMLIST_CHANNEL (iface);
- IdleRoomlistChannelPrivate *priv;
g_assert (obj != NULL);
g_assert (IDLE_IS_ROOMLIST_CHANNEL (obj));
- priv = IDLE_ROOMLIST_CHANNEL_GET_PRIVATE (obj);
- priv->closed = TRUE;
-
- IDLE_DEBUG ("called on %p", obj);
-
- tp_svc_channel_emit_closed (iface);
+ g_object_run_dispose (G_OBJECT (iface));
tp_svc_channel_return_from_close (context);
}
diff --git a/src/idle-roomlist-manager.c b/src/idle-roomlist-manager.c
index c2435ab..f8f46f8 100644
--- a/src/idle-roomlist-manager.c
+++ b/src/idle-roomlist-manager.c
@@ -185,11 +185,17 @@ static void
_roomlist_manager_close_all (IdleRoomlistManager *self)
{
IdleRoomlistManagerPrivate *priv = IDLE_ROOMLIST_MANAGER_GET_PRIVATE (self);
+ IdleRoomlistChannel *tmp;
- if (priv->channel)
+ if (priv->channel != NULL)
{
- g_object_unref(priv->channel);
+ /* use a temporary variable and set priv->channel to NULL first
+ * because unreffing this channel will cause the
+ * _roomlist_channel_closed_cb to fire, which will try to unref it
+ * again if priv->channel is not NULL */
+ tmp = priv->channel;
priv->channel = NULL;
+ g_object_unref(tmp);
}
if (priv->status_changed_id != 0)
{