Mercurial > pidgin
changeset 27644:f24885ec506b
Set the session error after disconnecting the servconn instead of before.
The disconnect callback may try to do something that would set another
error, thus hiding the original one.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Tue, 21 Jul 2009 03:56:44 +0000 |
parents | 577bf7ea0395 |
children | 97ba0d9e6e54 |
files | libpurple/protocols/msn/servconn.c |
diffstat | 1 files changed, 12 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/msn/servconn.c Mon Jul 20 05:11:50 2009 +0000 +++ b/libpurple/protocols/msn/servconn.c Tue Jul 21 03:56:44 2009 +0000 @@ -125,13 +125,14 @@ void msn_servconn_got_error(MsnServConn *servconn, MsnServConnError error) { - char *tmp; + MsnSession *session = servconn->session; + MsnServConnType type = servconn->type; const char *reason; const char *names[] = { "Notification", "Switchboard" }; const char *name; - name = names[servconn->type]; + name = names[type]; switch (error) { @@ -147,14 +148,8 @@ purple_debug_error("msn", "Connection error from %s server (%s): %s\n", name, servconn->host, reason); - tmp = g_strdup_printf(_("Connection error from %s server:\n%s"), - name, reason); - if (servconn->type == MSN_SERVCONN_NS) - { - msn_session_set_error(servconn->session, MSN_ERROR_SERVCONN, tmp); - } - else if (servconn->type == MSN_SERVCONN_SB) + if (type == MSN_SERVCONN_SB) { MsnSwitchBoard *swboard; swboard = servconn->cmdproc->data; @@ -162,9 +157,16 @@ swboard->error = MSN_SB_ERROR_CONNECTION; } + /* servconn->disconnect_cb may destroy servconn, so don't use it again */ msn_servconn_disconnect(servconn); - g_free(tmp); + if (type == MSN_SERVCONN_NS) + { + char *tmp = g_strdup_printf(_("Connection error from %s server:\n%s"), + name, reason); + msn_session_set_error(session, MSN_ERROR_SERVCONN, tmp); + g_free(tmp); + } } /**************************************************************************