From 1eb364bb98ec75f0387354e320e07f619319528f Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Fri, 9 May 2008 08:06:22 +0000 Subject: Do not unref tp_chat directly in the message_received callback to avoid a crash. svn path=/trunk/; revision=1097 --- src/empathy-status-icon.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/empathy-status-icon.c b/src/empathy-status-icon.c index bd18b2d28..f33447033 100644 --- a/src/empathy-status-icon.c +++ b/src/empathy-status-icon.c @@ -368,6 +368,13 @@ status_icon_channel_process (EmpathyStatusIcon *icon, g_object_unref (channel); } +static gboolean +status_icon_chat_unref_idle (gpointer user_data) +{ + g_object_unref (user_data); + return FALSE; +} + static void status_icon_chat_message_received_cb (EmpathyTpChat *tp_chat, EmpathyMessage *message, @@ -377,6 +384,11 @@ status_icon_chat_message_received_cb (EmpathyTpChat *tp_chat, gchar *msg; TpChannel *channel; + g_idle_add (status_icon_chat_unref_idle, tp_chat); + g_signal_handlers_disconnect_by_func (tp_chat, + status_icon_chat_message_received_cb, + icon); + sender = empathy_message_get_sender (message); msg = g_strdup_printf (_("New message from %s:\n%s"), empathy_contact_get_name (sender), @@ -388,7 +400,6 @@ status_icon_chat_message_received_cb (EmpathyTpChat *tp_chat, g_object_ref (channel)); g_free (msg); - g_object_unref (tp_chat); } static void -- cgit v1.2.3