Mercurial > pidgin
comparison src/protocols/simple/simple.c @ 13580:dc28bca6a7b5
[gaim-migrate @ 15962]
Fix a crash in the simple PRPL when the account is disabled while
a dns srv lookup is in progress.
committer: Tailor Script <tailor@pidgin.im>
| author | Mark Doliner <mark@kingant.net> |
|---|---|
| date | Tue, 04 Apr 2006 22:13:12 +0000 |
| parents | bddf037063bd |
| children | bbab6b311195 |
comparison
equal
deleted
inserted
replaced
| 13579:ffb752f106ec | 13580:dc28bca6a7b5 |
|---|---|
| 1518 gaim_connection_error(sip->gc, _("Couldn't create socket")); | 1518 gaim_connection_error(sip->gc, _("Couldn't create socket")); |
| 1519 } | 1519 } |
| 1520 } | 1520 } |
| 1521 | 1521 |
| 1522 static void srvresolved(GaimSrvResponse *resp, int results, gpointer data) { | 1522 static void srvresolved(GaimSrvResponse *resp, int results, gpointer data) { |
| 1523 struct simple_account_data *sip = (struct simple_account_data*) data; | 1523 GaimConnection *gc; |
| 1524 | 1524 struct simple_account_data *sip; |
| 1525 gchar *hostname; | 1525 gchar *hostname; |
| 1526 int port = gaim_account_get_int(sip->account, "port", 0); | 1526 int port; |
| 1527 | |
| 1528 gc = data; | |
| 1529 if (!g_list_find(gaim_connections_get_all(), gc)) | |
| 1530 { | |
| 1531 /* This connection has been closed */ | |
| 1532 g_free(resp); | |
| 1533 return; | |
| 1534 } | |
| 1535 | |
| 1536 sip = gc->proto_data; | |
| 1537 port = gaim_account_get_int(sip->account, "port", 0); | |
| 1527 | 1538 |
| 1528 /* find the host to connect to */ | 1539 /* find the host to connect to */ |
| 1529 if(results) { | 1540 if(results) { |
| 1530 hostname = g_strdup(resp->hostname); | 1541 hostname = g_strdup(resp->hostname); |
| 1531 if(!port) | 1542 if(!port) |
| 1602 hosttoconnect = g_strdup(gaim_account_get_string(account, "proxy", sip->servername)); | 1613 hosttoconnect = g_strdup(gaim_account_get_string(account, "proxy", sip->servername)); |
| 1603 } | 1614 } |
| 1604 | 1615 |
| 1605 /* TCP case */ | 1616 /* TCP case */ |
| 1606 if(!sip->udp) { | 1617 if(!sip->udp) { |
| 1607 gaim_srv_resolve("sip", "tcp", hosttoconnect, srvresolved, sip); | 1618 gaim_srv_resolve("sip", "tcp", hosttoconnect, srvresolved, gc); |
| 1608 } else { /* UDP */ | 1619 } else { /* UDP */ |
| 1609 gaim_srv_resolve("sip", "udp", hosttoconnect, srvresolved, sip); | 1620 gaim_srv_resolve("sip", "udp", hosttoconnect, srvresolved, gc); |
| 1610 } | 1621 } |
| 1611 g_free(hosttoconnect); | 1622 g_free(hosttoconnect); |
| 1612 } | 1623 } |
| 1613 | 1624 |
| 1614 static void simple_close(GaimConnection *gc) | 1625 static void simple_close(GaimConnection *gc) |
