empathy r1097 - trunk/src



Author: xclaesse
Date: Fri May  9 08:06:22 2008
New Revision: 1097
URL: http://svn.gnome.org/viewvc/empathy?rev=1097&view=rev

Log:
Do not unref tp_chat directly in the message_received callback to avoid a crash.


Modified:
   trunk/src/empathy-status-icon.c

Modified: trunk/src/empathy-status-icon.c
==============================================================================
--- trunk/src/empathy-status-icon.c	(original)
+++ trunk/src/empathy-status-icon.c	Fri May  9 08:06:22 2008
@@ -368,6 +368,13 @@
 	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 @@
 	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 @@
 			       g_object_ref (channel));
 
 	g_free (msg);
-	g_object_unref (tp_chat);
 }
 
 static void



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]