comparison src/account.c @ 7324:4963abdebd29

[gaim-migrate @ 7910] Fixed a crash when deleting an account that has IMs or chats open. Closes bug #821630. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Fri, 24 Oct 2003 22:01:58 +0000
parents 412163e23000
children c57206d8753f
comparison
equal deleted inserted replaced
7323:443fc7d6fbff 7324:4963abdebd29
151 } 151 }
152 152
153 void 153 void
154 gaim_account_destroy(GaimAccount *account) 154 gaim_account_destroy(GaimAccount *account)
155 { 155 {
156 GList *l;
157
156 g_return_if_fail(account != NULL); 158 g_return_if_fail(account != NULL);
157 159
158 gaim_debug(GAIM_DEBUG_INFO, "account", 160 gaim_debug(GAIM_DEBUG_INFO, "account",
159 "Destroying account %p\n", account); 161 "Destroying account %p\n", account);
160 162
161 if (account->gc != NULL) 163 if (account->gc != NULL)
162 gaim_connection_destroy(account->gc); 164 gaim_connection_destroy(account->gc);
163 165
164 gaim_debug(GAIM_DEBUG_INFO, "account", 166 gaim_debug(GAIM_DEBUG_INFO, "account",
165 "Continuing to destroy account %p\n", account); 167 "Continuing to destroy account %p\n", account);
168
169 for (l = gaim_get_conversations(); l != NULL; l = l->next)
170 {
171 GaimConversation *conv = (GaimConversation *)l->data;
172
173 if (gaim_conversation_get_account(conv) == account)
174 gaim_conversation_set_account(conv, NULL);
175 }
166 176
167 if (account->username != NULL) g_free(account->username); 177 if (account->username != NULL) g_free(account->username);
168 if (account->alias != NULL) g_free(account->alias); 178 if (account->alias != NULL) g_free(account->alias);
169 if (account->password != NULL) g_free(account->password); 179 if (account->password != NULL) g_free(account->password);
170 if (account->user_info != NULL) g_free(account->user_info); 180 if (account->user_info != NULL) g_free(account->user_info);