comparison src/status.c @ 10580:662a99c6701f

[gaim-migrate @ 11978] sf patch #1112736, from Felipe Contreras Fix a thing where we might free a GaimPresence when it is still in use committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Mon, 07 Feb 2005 23:29:48 +0000
parents 54f7939df8e3
children 7d4ca0d36f25
comparison
equal deleted inserted replaced
10579:71478e6a6074 10580:662a99c6701f
1167 1167
1168 if (gaim_presence_get_context(presence) == GAIM_PRESENCE_CONTEXT_BUDDY) 1168 if (gaim_presence_get_context(presence) == GAIM_PRESENCE_CONTEXT_BUDDY)
1169 { 1169 {
1170 GaimStatusBuddyKey key; 1170 GaimStatusBuddyKey key;
1171 1171
1172 presence->u.buddy.ref_count--;
1173
1174 if(presence->u.buddy.ref_count != 0) 1172 if(presence->u.buddy.ref_count != 0)
1175 return; 1173 return;
1176 1174
1177 key.account = presence->u.buddy.account; 1175 key.account = presence->u.buddy.account;
1178 key.name = presence->u.buddy.name; 1176 key.name = presence->u.buddy.name;
1194 g_hash_table_destroy(presence->status_table); 1192 g_hash_table_destroy(presence->status_table);
1195 1193
1196 g_free(presence); 1194 g_free(presence);
1197 } 1195 }
1198 1196
1197 /*
1198 * TODO: Maybe we should cal gaim_presence_destroy() after we
1199 * decrement the ref count? I don't see why we should
1200 * make other places do it manually when we can do it here.
1201 */
1199 void 1202 void
1200 gaim_presence_remove_buddy(GaimPresence *presence, GaimBuddy *buddy) 1203 gaim_presence_remove_buddy(GaimPresence *presence, GaimBuddy *buddy)
1201 { 1204 {
1202 g_return_if_fail(presence != NULL); 1205 g_return_if_fail(presence != NULL);
1203 g_return_if_fail(buddy != NULL); 1206 g_return_if_fail(buddy != NULL);