# HG changeset patch # User Richard Laager # Date 1130073128 0 # Node ID 7da512f06185c891f26f288421164658a2f9d2a7 # Parent 6fa0a37127fd42400ff277674c014b19f51b85c7 [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 diff -r 6fa0a37127fd -r 7da512f06185 plugins/idle.c --- 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); } }