From: <the...@us...> - 2006-06-30 06:58:40
|
Revision: 16378 Author: thekingant Date: 2006-06-29 23:58:38 -0700 (Thu, 29 Jun 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16378&view=rev Log Message: ----------- Backport SVN revision #16377 from HEAD to v2_0_0 Original commit message: Fix a crash bug pointed out by Alexander Sashnov: There is another segfault (on today SVN trunk version). Steps for reproduce: 1. Create jabber account with incorrect params, check it for connect on start up; 2. run Gaim again. It will not connect and see error message in bottom of users list; 3. Open 'accounts' dialog and deselect this account..... segfault :-) ViewCVS Links: ------------- http://svn.sourceforge.net/gaim/?rev=16377&view=rev Modified Paths: -------------- branches/v2_0_0/src/dnssrv.c branches/v2_0_0/src/protocols/jabber/jabber.c Modified: branches/v2_0_0/src/dnssrv.c =================================================================== --- branches/v2_0_0/src/dnssrv.c 2006-06-30 06:58:17 UTC (rev 16377) +++ branches/v2_0_0/src/dnssrv.c 2006-06-30 06:58:38 UTC (rev 16378) @@ -275,6 +275,12 @@ #endif +/* + * TODO: It would be really good if this returned some sort of handle + * that we could use to cancel the DNS query. As it is now, + * each callback has to check to make sure gc is still valid. + * And that is ugly. + */ void gaim_srv_resolve(const char *protocol, const char *transport, const char *domain, GaimSRVCallback cb, gpointer extradata) { char *query = g_strdup_printf("_%s._%s.%s",protocol, transport, domain); struct resdata *rdata; Modified: branches/v2_0_0/src/protocols/jabber/jabber.c =================================================================== --- branches/v2_0_0/src/protocols/jabber/jabber.c 2006-06-30 06:58:17 UTC (rev 16377) +++ branches/v2_0_0/src/protocols/jabber/jabber.c 2006-06-30 06:58:38 UTC (rev 16378) @@ -481,8 +481,19 @@ static void srv_resolved_cb(GaimSrvResponse *resp, int results, gpointer data) { - JabberStream *js = (JabberStream*)data; + GaimConnection *gc; + JabberStream *js; + gc = data; + if (!g_list_find(gaim_connections_get_all(), gc)) + { + /* This connection has been closed */ + g_free(resp); + return; + } + + js = (JabberStream*)gc->proto_data; + if(results) { jabber_login_connect(js, resp->hostname, resp->port); g_free(resp); @@ -561,7 +572,7 @@ if(connect_server[0]) { jabber_login_connect(js, connect_server, gaim_account_get_int(account, "port", 5222)); } else { - gaim_srv_resolve("xmpp-client", "tcp", js->user->domain, srv_resolved_cb, js); + gaim_srv_resolve("xmpp-client", "tcp", js->user->domain, srv_resolved_cb, gc); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |