changeset 30666:8c1a2ef5a713

Destroy a DC if its corresponding slpcall is going away and it hasn't established itself yet. Otherwise, it might timeout later and try to access the old slpcall. Fixes #12072.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Sat, 03 Jul 2010 23:45:59 +0000
parents a14c2e81fcf0
children f55609d9bea5
files libpurple/protocols/msn/slplink.c
diffstat 1 files changed, 10 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/slplink.c	Fri Jul 02 00:32:20 2010 +0000
+++ b/libpurple/protocols/msn/slplink.c	Sat Jul 03 23:45:59 2010 +0000
@@ -214,11 +214,16 @@
 		slplink->swboard = NULL;
 	}
 
-	/* The slplink has no slpcalls in it, release it from the DC. */
-	if (slplink->slp_calls == NULL && slplink->dc != NULL) {
-		slplink->dc->slplink = NULL;
-		msn_dc_destroy(slplink->dc);
-		slplink->dc = NULL;
+	if (slplink->dc != NULL) {
+		if ((slplink->dc->state != DC_STATE_ESTABLISHED && slplink->dc->slpcall == slpcall)
+		 || (slplink->slp_calls == NULL)) {
+			/* The DC is not established and its corresponding slpcall is dead,
+			 * or the slplink has no slpcalls in it and no longer needs the DC.
+			 */
+			slplink->dc->slplink = NULL;
+			msn_dc_destroy(slplink->dc);
+			slplink->dc = NULL;
+		}
 	}
 }