changeset 5897:e3733414ca08

[gaim-migrate @ 6329] Fixed the MSN segfault on XFR, where we were accessing a servconn that was destroyed, due to it being the old notification server that was replaced during XFR. Did that make sense to anybody? committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Sun, 15 Jun 2003 19:23:59 +0000
parents a156d08e481e
children 5baeb89ee2d4
files src/protocols/msn/servconn.c
diffstat 1 files changed, 18 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/msn/servconn.c	Sun Jun 15 18:22:11 2003 +0000
+++ b/src/protocols/msn/servconn.c	Sun Jun 15 19:23:59 2003 +0000
@@ -54,15 +54,19 @@
 static gboolean
 process_single_line(MsnServConn *servconn, char *str)
 {
+	MsnSession *session = servconn->session;
 	MsnServConnCommandCb cb;
-	GSList *l, *l_next;
+	GSList *l, *l_next = NULL;
 	gboolean result;
 	size_t param_count = 0;
 	char *command, *param_start;
 	char **params = NULL;
+	MsnServConn *old_notification_conn;
 
 	command = str;
 
+	old_notification_conn = session->notification_conn;
+
 	/**
 	 * See how many spaces we have in this.
 	 */
@@ -98,7 +102,19 @@
 	if (params != NULL)
 		g_strfreev(params);
 
-	
+	/*
+	 * We're checking here if the old notification server was replaced
+	 * with a new one, and if the current servconn here is the old
+	 * notification server. If so, we're going to have a bit of trouble
+	 * in the upcoming loop, as servconn will be a freed variable, so
+	 * we'll just return early.
+	 */
+	if (servconn == old_notification_conn &&
+		old_notification_conn != session->notification_conn) {
+
+		return result;
+	}
+
 	/* Process all queued messages that are waiting on this command. */
 	for (l = servconn->msg_queue; l != NULL; l = l_next) {
 		MsnQueueEntry *entry = l->data;