comparison libpurple/protocols/msn/slpmsg.c @ 31261:ede71a46ef16

Destroy Parts when the SlpMessage is destroyed.
author masca@cpw.pidgin.im
date Tue, 22 Jun 2010 22:44:28 +0000
parents fd4b918a9b2f
children 91ba047e838c
comparison
equal deleted inserted replaced
31260:e0dd17804079 31261:ede71a46ef16
24 24
25 #include "internal.h" 25 #include "internal.h"
26 #include "debug.h" 26 #include "debug.h"
27 27
28 #include "slpmsg.h" 28 #include "slpmsg.h"
29 #include "slpmsg_part.h"
29 #include "slplink.h" 30 #include "slplink.h"
30 31
31 /************************************************************************** 32 /**************************************************************************
32 * SLP Message 33 * SLP Message
33 **************************************************************************/ 34 **************************************************************************/
118 119
119 msg->ack_cb = NULL; 120 msg->ack_cb = NULL;
120 msg->nak_cb = NULL; 121 msg->nak_cb = NULL;
121 msg->ack_data = NULL; 122 msg->ack_data = NULL;
122 msn_message_unref(msg); 123 msn_message_unref(msg);
124 }
125
126 slplink->slp_msgs = g_list_remove(slplink->slp_msgs, slpmsg);
127
128 for (cur = slpmsg->parts; cur != NULL; cur = g_list_delete_link(cur, cur))
129 {
130 /* Something is pointing to this slpmsg, so we should remove that
131 * pointer to prevent a crash. */
132 /* Ex: a user goes offline and after that we receive an ACK */
133
134 MsnSlpMessagePart *part = cur->data;
135
136 part->ack_cb = NULL;
137 part->nak_cb = NULL;
138 part->ack_data = NULL;
139 msn_slpmsgpart_destroy(part);
123 } 140 }
124 141
125 slplink->slp_msgs = g_list_remove(slplink->slp_msgs, slpmsg); 142 slplink->slp_msgs = g_list_remove(slplink->slp_msgs, slpmsg);
126 143
127 g_free(slpmsg->header); 144 g_free(slpmsg->header);