]> git.0d.be Git - empathy.git/commitdiff
Don't leak queued messages if EmpathyTpChat gets finalized.
authorXavier Claessens <xclaesse@src.gnome.org>
Fri, 9 May 2008 08:06:19 +0000 (08:06 +0000)
committerXavier Claessens <xclaesse@src.gnome.org>
Fri, 9 May 2008 08:06:19 +0000 (08:06 +0000)
svn path=/trunk/; revision=1096

libempathy/empathy-tp-chat.c

index f0d7820a9919154a1ef79175fe1aa098137828c5..286896bbefa05d0a4ef62f07f4365caab3ba6dbb 100644 (file)
@@ -834,6 +834,8 @@ tp_chat_finalize (GObject *object)
        EmpathyTpChatPriv *priv = GET_PRIV (object);
        guint              i;
 
+       DEBUG ("Finalize: %p", object);
+
        if (priv->acknowledge && priv->channel) {
                DEBUG ("Closing channel...");
                tp_cli_channel_call_close (priv->channel, -1,
@@ -875,6 +877,19 @@ tp_chat_finalize (GObject *object)
        g_object_unref (priv->account);
        g_free (priv->id);
 
+       if (priv->message_queue) {
+               EmpathyMessage *message;
+               EmpathyContact *contact;
+
+               message = priv->message_queue->data;
+               contact = empathy_message_get_sender (message);
+               g_signal_handlers_disconnect_by_func (contact,
+                                                     tp_chat_sender_ready_notify_cb,
+                                                     object);
+       }
+       g_slist_foreach (priv->message_queue, (GFunc) g_object_unref, NULL);
+       g_slist_free (priv->message_queue);
+
        G_OBJECT_CLASS (empathy_tp_chat_parent_class)->finalize (object);
 }