diff src/connection.c @ 6003:0ca618645cec

[gaim-migrate @ 6451] this fixes a couple jabber segfaults, and hopefully doesn't break anything. committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Thu, 03 Jul 2003 18:27:22 +0000
parents 03f1d6cd784c
children 9ab75d4fafac
line wrap: on
line diff
--- a/src/connection.c	Thu Jul 03 14:24:49 2003 +0000
+++ b/src/connection.c	Thu Jul 03 18:27:22 2003 +0000
@@ -50,6 +50,8 @@
 	gaim_connection_set_account(gc, account);
 	gaim_account_set_connection(account, gc);
 
+	connections = g_list_append(connections, gc);
+
 	return gc;
 }
 
@@ -69,6 +71,8 @@
 	gaim_debug(GAIM_DEBUG_INFO, "connection",
 			   "Destroying connection %p\n", gc);
 
+	connections = g_list_remove(connections, gc);
+
 	account = gaim_connection_get_account(gc);
 	gaim_account_set_connection(account, NULL);
 
@@ -118,8 +122,6 @@
 
 	gaim_debug(GAIM_DEBUG_INFO, "connection", "Calling serv_login\n");
 
-	connections = g_list_append(connections, gc);
-
 	serv_login(account);
 }
 
@@ -147,8 +149,6 @@
 
 		serv_close(gc);
 
-		connections = g_list_remove(connections, gc);
-
 		gaim_connection_set_state(gc, GAIM_DISCONNECTED);
 
 		gaim_event_broadcast(event_signoff, gc);
@@ -348,6 +348,12 @@
 		ops->notice(gc, text);
 }
 
+static gboolean disconnect_conn_cb(gpointer data)
+{
+	gaim_connection_disconnect(data);
+	return FALSE;
+}
+
 void
 gaim_connection_error(GaimConnection *gc, const char *text)
 {
@@ -361,7 +367,7 @@
 	if (ops != NULL && ops->disconnected != NULL)
 		ops->disconnected(gc, text);
 
-	gaim_connection_disconnect(gc);
+	g_timeout_add(0, disconnect_conn_cb, gc);
 }
 
 void