soc.2010.msn-tlc: b81a6f79: Destroy Parts when the SlpMessage is des...

masca at cpw.pidgin.im masca at cpw.pidgin.im
Thu Jun 24 02:16:44 EDT 2010


-----------------------------------------------------------------
Revision: b81a6f79809ae0b0f6f4a31c88b66be7901d34b8
Ancestor: 7e78afba8cdbfef368ec900086f58fbf49e06221
Author: masca at cpw.pidgin.im
Date: 2010-06-22T22:44:28
Branch: im.pidgin.soc.2010.msn-tlc
URL: http://d.pidgin.im/viewmtn/revision/info/b81a6f79809ae0b0f6f4a31c88b66be7901d34b8

Modified files:
        libpurple/protocols/msn/slpmsg.c

ChangeLog: 

Destroy Parts when the SlpMessage is destroyed.

-------------- next part --------------
============================================================
--- libpurple/protocols/msn/slpmsg.c	ab6236e6b81765ad2e450f6841f9c765d4ed18f0
+++ libpurple/protocols/msn/slpmsg.c	ecf1b880b1dc93d7303f1c015bd6abb857d530fc
@@ -26,6 +26,7 @@
 #include "debug.h"
 
 #include "slpmsg.h"
+#include "slpmsg_part.h"
 #include "slplink.h"
 
 /**************************************************************************
@@ -124,6 +125,22 @@ msn_slpmsg_destroy(MsnSlpMessage *slpmsg
 
 	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);
 


More information about the Commits mailing list