changeset 31261:ede71a46ef16

Destroy Parts when the SlpMessage is destroyed.
author masca@cpw.pidgin.im
date Tue, 22 Jun 2010 22:44:28 +0000
parents e0dd17804079
children a743c25b27a8
files libpurple/protocols/msn/slpmsg.c
diffstat 1 files changed, 17 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/slpmsg.c	Tue Jun 22 22:44:13 2010 +0000
+++ b/libpurple/protocols/msn/slpmsg.c	Tue Jun 22 22:44:28 2010 +0000
@@ -26,6 +26,7 @@
 #include "debug.h"
 
 #include "slpmsg.h"
+#include "slpmsg_part.h"
 #include "slplink.h"
 
 /**************************************************************************
@@ -124,6 +125,22 @@
 
 	slplink->slp_msgs = g_list_remove(slplink->slp_msgs, slpmsg);
 
+	for (cur = slpmsg->parts; cur != NULL; cur = g_list_delete_link(cur, cur))
+	{
+		/* Something is pointing to this slpmsg, so we should remove that
+		 * pointer to prevent a crash. */
+		/* Ex: a user goes offline and after that we receive an ACK */
+
+		MsnSlpMessagePart *part = cur->data;
+
+		part->ack_cb = NULL;
+		part->nak_cb = NULL;
+		part->ack_data = NULL;
+		msn_slpmsgpart_destroy(part);
+	}
+
+	slplink->slp_msgs = g_list_remove(slplink->slp_msgs, slpmsg);
+
 	g_free(slpmsg->header);
 	g_free(slpmsg->footer);