Destroy a DC if its corresponding slpcall is going away and it hasn't

Sat, 03 Jul 2010 23:45:59 +0000

author
Elliott Sales de Andrade <qulogic@pidgin.im>
date
Sat, 03 Jul 2010 23:45:59 +0000
changeset 30492
7d49d1421450
parent 30491
343ac123ff38
child 30493
5fd03d018cc1

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.

libpurple/protocols/msn/slplink.c file | annotate | diff | comparison | revisions
--- 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;
+		}
 	}
 }
 

mercurial