changeset 11749:7da512f06185

[gaim-migrate @ 14040] SF Patch #1335433, from sadrul ...who else? ;) "Using the idle-maker plugin, Idle some account. Unidle it. Idle it again. Now `Unset idle time for all accounts'. Gaim seems to crash." This looks good to me. It compiles. committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Sun, 23 Oct 2005 13:12:08 +0000
parents 6fa0a37127fd
children 21aff66af1e7
files plugins/idle.c
diffstat 1 files changed, 9 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/idle.c	Sun Oct 23 13:10:58 2005 +0000
+++ b/plugins/idle.c	Sun Oct 23 13:12:08 2005 +0000
@@ -52,6 +52,9 @@
 	GaimConnection *gc = gaim_account_get_connection(acct);
 	GaimPresence *presence = gaim_account_get_presence(acct);
 
+	if (!gc)
+		return;
+
 	gaim_debug(GAIM_DEBUG_INFO, "idle",
 			"setting idle time for %s to %d\n",
 			gaim_account_get_username(acct), mins_idle);
@@ -93,7 +96,7 @@
 	set_idle_time(acct, 0); /* unidle the account */
 
 	/* once the account has been unidled it shouldn't be in the list */
-	g_list_remove(idled_accts, acct);
+	idled_accts = g_list_remove(idled_accts, acct);
 }
 
 
@@ -162,9 +165,11 @@
 	
 	/* freeing the list here will cause segfaults if the user idles an account
 	 * after the list is freed */
-	for (l = idled_accts; l; l = l->next) {
-		set_idle_time((GaimAccount *)(l->data), 0);
-		g_list_remove(idled_accts, l->data);
+	for (l = idled_accts; l; ) {
+		GaimAccount *account = l->data;
+		set_idle_time(account, 0);
+		l = l->next;
+		idled_accts = g_list_remove(idled_accts, account);
 	}
 		
 }