changeset 13580:dc28bca6a7b5

[gaim-migrate @ 15962] Fix a crash in the simple PRPL when the account is disabled while a dns srv lookup is in progress. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Tue, 04 Apr 2006 22:13:12 +0000
parents ffb752f106ec
children a33208cc6247
files src/protocols/simple/simple.c
diffstat 1 files changed, 16 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/simple/simple.c	Tue Apr 04 21:33:46 2006 +0000
+++ b/src/protocols/simple/simple.c	Tue Apr 04 22:13:12 2006 +0000
@@ -1520,10 +1520,21 @@
 }
 
 static void srvresolved(GaimSrvResponse *resp, int results, gpointer data) {
-	struct simple_account_data *sip = (struct simple_account_data*) data;
+	GaimConnection *gc;
+	struct simple_account_data *sip;
+	gchar *hostname;
+	int port;
 
-	gchar *hostname;
-	int port = gaim_account_get_int(sip->account, "port", 0);
+	gc = data;
+	if (!g_list_find(gaim_connections_get_all(), gc))
+	{
+		/* This connection has been closed */
+		g_free(resp);
+		return;
+	}
+
+	sip = gc->proto_data;
+	port = gaim_account_get_int(sip->account, "port", 0);
 
 	/* find the host to connect to */
 	if(results) {
@@ -1604,9 +1615,9 @@
 
 	/* TCP case */
 	if(!sip->udp) {
-		gaim_srv_resolve("sip", "tcp", hosttoconnect, srvresolved, sip);
+		gaim_srv_resolve("sip", "tcp", hosttoconnect, srvresolved, gc);
 	} else { /* UDP */
-		gaim_srv_resolve("sip", "udp", hosttoconnect, srvresolved, sip);
+		gaim_srv_resolve("sip", "udp", hosttoconnect, srvresolved, gc);
 	}
 	g_free(hosttoconnect);
 }