comparison libgaim/connection.c @ 14752:4124030c3f3a

[gaim-migrate @ 17509] Fix the situation (I think it will only happen while shutting down) where GaimBuddy->proto_data could be accessed after it is freed. Specifically, it happened when gtkblist was requesting the emblems from the msn prpl. Big thanks to henningn for noticing the funkiness in valgrind. I discovered that there is no function to retrieve all the buddies for an account (shock, horror) - so I modified gaim_find_buddies() to return all the account buddies if "name" is NULL. committer: Tailor Script <tailor@pidgin.im>
author Daniel Atallah <daniel.atallah@gmail.com>
date Wed, 18 Oct 2006 03:32:14 +0000
parents f23506e8f812
children 71404dbedabc
comparison
equal deleted inserted replaced
14751:510da3975938 14752:4124030c3f3a
158 158
159 void 159 void
160 gaim_connection_destroy(GaimConnection *gc) 160 gaim_connection_destroy(GaimConnection *gc)
161 { 161 {
162 GaimAccount *account; 162 GaimAccount *account;
163 GSList *buddies, *tmp;
163 #if 0 164 #if 0
164 GList *wins; 165 GList *wins;
165 #endif 166 #endif
166 GaimPluginProtocolInfo *prpl_info = NULL; 167 GaimPluginProtocolInfo *prpl_info = NULL;
167 gboolean remove = FALSE; 168 gboolean remove = FALSE;
192 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); 193 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
193 194
194 if (prpl_info->close) 195 if (prpl_info->close)
195 (prpl_info->close)(gc); 196 (prpl_info->close)(gc);
196 } 197 }
198
199 /* Clear out the proto data that was freed in the prpl close method*/
200 buddies = gaim_find_buddies(account, NULL);
201 for (tmp = buddies; tmp; tmp = tmp->next) {
202 GaimBuddy *buddy = tmp->data;
203 buddy->proto_data = NULL;
204 }
205 g_slist_free(buddies);
197 206
198 connections = g_list_remove(connections, gc); 207 connections = g_list_remove(connections, gc);
199 208
200 gaim_connection_set_state(gc, GAIM_DISCONNECTED); 209 gaim_connection_set_state(gc, GAIM_DISCONNECTED);
201 210