diff libpurple/protocols/msn/slplink.c @ 30736:2bc54dfae627

propagate from branch 'im.pidgin.pidgin' (head fcd99a6bb8c6362d64f295a1b95a5b1130460b85) to branch 'im.pidgin.cpw.qulogic.msnp16' (head cbd8759937c56ce697bc9ca16dc2c5961905a0af)
author masca@cpw.pidgin.im
date Wed, 26 May 2010 19:47:56 +0000
parents 66e7fe9f7810 287fc4ac2bd9
children a99b6dcdb60d 562498203fe8
line wrap: on
line diff
--- a/libpurple/protocols/msn/slplink.c	Sat May 22 06:27:18 2010 +0000
+++ b/libpurple/protocols/msn/slplink.c	Wed May 26 19:47:56 2010 +0000
@@ -101,8 +101,11 @@
 
 	session = slplink->session;
 
-	if (slplink->dc != NULL)
+	if (slplink->dc != NULL) {
+		slplink->dc->slplink = NULL;
 		msn_dc_destroy(slplink->dc);
+		slplink->dc = NULL;
+	}
 
 	while (slplink->slp_calls != NULL)
 		msn_slpcall_destroy(slplink->slp_calls->data);
@@ -203,12 +206,16 @@
 	/* The slplink has no slpcalls in it, release it from MSN_SB_FLAG_FT.
 	 * If nothing else is using it then this might cause swboard to be
 	 * destroyed. */
-	if (slplink->slp_calls == NULL && slplink->swboard != NULL)
+	if (slplink->slp_calls == NULL && slplink->swboard != NULL) {
 		msn_switchboard_release(slplink->swboard, MSN_SB_FLAG_FT);
+		slplink->swboard = NULL;
+	}
 
 	/* The slplink has no slpcalls in it, release it from the DC. */
-	if (slplink->slp_calls == NULL && slplink->dc != NULL)
+	if (slplink->slp_calls == NULL && slplink->dc != NULL) {
 		msn_dc_destroy(slplink->dc);
+		slplink->dc = NULL;
+	}
 }
 
 MsnSlpCall *
@@ -315,7 +322,7 @@
 #endif
 
 	slpmsg->msgs =
-		g_list_append(slpmsg->msgs, msg);
+		g_list_append(slpmsg->msgs, msn_message_ref(msg));
 	msn_slplink_send_msg(slplink, msg);
 
 	if ((slpmsg->flags == 0x20 || slpmsg->flags == 0x1000020 ||
@@ -374,6 +381,8 @@
 			}
 		}
 	}
+
+	msn_message_unref(msg);
 }
 
 /* We have received the message nak. */
@@ -387,6 +396,7 @@
 	msn_slplink_send_msgpart(slpmsg->slplink, slpmsg);
 
 	slpmsg->msgs = g_list_remove(slpmsg->msgs, msg);
+	msn_message_unref(msg);
 }
 
 static void