changeset 10384:b234ad7e0dfe

[gaim-migrate @ 11610] I think this is a better fix for the jabber problem. I think that gaim_account_get_connection should never return NULL when called inside a prpl from a function being called by the core. I think ChipX86 wrote the code that I'm changing that made account->gc = NULL. So if he has any objections, he should raise them. committer: Tailor Script <tailor@pidgin.im>
author Tim Ringenbach <marv@pidgin.im>
date Wed, 15 Dec 2004 22:25:55 +0000
parents f2035bdc4272
children 5ea6c9dd10a2
files src/account.c src/account.h src/connection.c
diffstat 3 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/account.c	Wed Dec 15 21:03:19 2004 +0000
+++ b/src/account.c	Wed Dec 15 22:25:55 2004 +0000
@@ -256,11 +256,13 @@
 
 	gaim_debug_info("account", "Disconnecting account %p\n", account);
 
+	account->disconnecting = TRUE;
 	gc = gaim_account_get_connection(account);
 
+	gaim_connection_disconnect(gc);
+
 	gaim_account_set_connection(account, NULL);
-
-	gaim_connection_disconnect(gc);
+	account->disconnecting = FALSE;
 }
 
 void
--- a/src/account.h	Wed Dec 15 21:03:19 2004 +0000
+++ b/src/account.h	Wed Dec 15 22:25:55 2004 +0000
@@ -62,6 +62,7 @@
 	char *protocol_id;          /**< The ID of the protocol.              */
 
 	GaimConnection *gc;         /**< The connection handle.               */
+	gboolean disconnecting;     /**< The account is currently disconnecting */
 
 	GHashTable *settings;       /**< Protocol-specific settings.          */
 	GHashTable *ui_settings;    /**< UI-specific settings.                */
--- a/src/connection.c	Wed Dec 15 21:03:19 2004 +0000
+++ b/src/connection.c	Wed Dec 15 22:25:55 2004 +0000
@@ -215,7 +215,7 @@
 
 	account = gaim_connection_get_account(gc);
 
-	if (gaim_account_get_connection(account) != NULL) {
+	if (!account->disconnecting) {
 		gaim_account_disconnect(account);
 		return;
 	}