From: <the...@us...> - 2006-07-01 18:06:40
|
Revision: 16387 Author: thekingant Date: 2006-07-01 11:06:36 -0700 (Sat, 01 Jul 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16387&view=rev Log Message: ----------- Backport SVN revision #16386 from HEAD to v2_0_0 Original commit message: sf patch #1497232, from Jono Cole, "Segfault in bonjour when another protocol is logged in" "The Bonjour protocol plugin was causing Gaim to segfault on receiving a message when other protocols were logged in. This is dependant on the active buddies in the buddy list and has been noticed the most when msn is used." ViewCVS Links: ------------- http://svn.sourceforge.net/gaim/?rev=16386&view=rev Modified Paths: -------------- branches/v2_0_0/src/protocols/bonjour/jabber.c Modified: branches/v2_0_0/src/protocols/bonjour/jabber.c =================================================================== --- branches/v2_0_0/src/protocols/bonjour/jabber.c 2006-07-01 18:04:55 UTC (rev 16386) +++ branches/v2_0_0/src/protocols/bonjour/jabber.c 2006-07-01 18:06:36 UTC (rev 16387) @@ -221,18 +221,29 @@ struct _check_buddy_by_address_t { char *address; GaimBuddy **gb; + BonjourJabber *bj; }; static void _check_buddy_by_address(gpointer key, gpointer value, gpointer data) { GaimBuddy *gb = (GaimBuddy*)value; - BonjourBuddy *bb = (BonjourBuddy*)gb->proto_data; - struct _check_buddy_by_address_t *d = (struct _check_buddy_by_address_t *)data; + BonjourBuddy *bb; + struct _check_buddy_by_address_t *cbba; - if (bb != NULL) { - if (g_strcasecmp(bb->ip, (char*)d->address) == 0) - *(d->gb) = gb; + gb = value; + cbba = data; + + /* + * If the current GaimBuddy's data is not null and the GaimBuddy's account + * is the same as the account requesting the check then continue to determine + * whether the buddies IP matches the target IP. + */ + if (cbba->bj->account == gb->account) + { + bb = gb->proto_data; + if ((bb != NULL) && (g_strcasecmp(bb->ip, cbba->address) == 0)) + *(cbba->gb) = gb; } } @@ -371,6 +382,7 @@ socklen_t sin_size = sizeof(struct sockaddr); int client_socket; BonjourBuddy *bb = NULL; + BonjourJabber *bj = data; char *address_text = NULL; GaimBuddyList *bl = gaim_get_blist(); struct _check_buddy_by_address_t *cbba; @@ -386,11 +398,12 @@ } fcntl(client_socket, F_SETFL, O_NONBLOCK); - /* Look for the buddy that has open the conversation and fill information */ + /* Look for the buddy that has opened the conversation and fill information */ address_text = inet_ntoa(their_addr.sin_addr); cbba = g_new0(struct _check_buddy_by_address_t, 1); cbba->address = address_text; cbba->gb = &gb; + cbba->bj = bj; g_hash_table_foreach(bl->buddies, _check_buddy_by_address, cbba); g_free(cbba); if (gb == NULL) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |