Mercurial > pidgin
changeset 31791:6ce4f2272abc
Fix a crash when the account is disconnected and we have requested a SB. (Hanzz, ported by shlomif)(Fixes #12431)
author | masca@cpw.pidgin.im |
---|---|
date | Sun, 14 Aug 2011 19:04:59 +0000 |
parents | edd063ee1016 |
children | 00ea0e58cf5f |
files | ChangeLog libpurple/protocols/msn/cmdproc.c libpurple/protocols/msn/cmdproc.h libpurple/protocols/msn/session.c libpurple/protocols/msn/switchboard.c libpurple/protocols/msn/switchboard.h |
diffstat | 6 files changed, 21 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Sat Aug 13 21:57:35 2011 +0000 +++ b/ChangeLog Sun Aug 14 19:04:59 2011 +0000 @@ -37,6 +37,8 @@ MSN: * Fix seemingly random crashing. (#14307) + * Fix a crash when the account is disconnected at the time we are doing a + SB request. (Hanzz, ported by shlomif) (#12431) XMPP: * Do not generate malformed XML ("</>") when setting an empty mood.
--- a/libpurple/protocols/msn/cmdproc.c Sat Aug 13 21:57:35 2011 +0000 +++ b/libpurple/protocols/msn/cmdproc.c Sun Aug 14 19:04:59 2011 +0000 @@ -109,21 +109,22 @@ g_free(show); } -void +gboolean msn_cmdproc_send_trans(MsnCmdProc *cmdproc, MsnTransaction *trans) { MsnServConn *servconn; char *data; size_t len; + gboolean ret; - g_return_if_fail(cmdproc != NULL); - g_return_if_fail(trans != NULL); + g_return_val_if_fail(cmdproc != NULL, TRUE); + g_return_val_if_fail(trans != NULL, TRUE); servconn = cmdproc->servconn; if (!servconn->connected) { msn_transaction_destroy(trans); - return; + return FALSE; } if (trans->saveable) @@ -154,11 +155,12 @@ trans->payload_len = 0; } - msn_servconn_write(servconn, data, len); + ret = msn_servconn_write(servconn, data, len) != -1; if (!trans->saveable) msn_transaction_destroy(trans); g_free(data); + return ret; } void
--- a/libpurple/protocols/msn/cmdproc.h Sat Aug 13 21:57:35 2011 +0000 +++ b/libpurple/protocols/msn/cmdproc.h Sun Aug 14 19:04:59 2011 +0000 @@ -79,7 +79,7 @@ * @param cmdproc The MsnCmdProc to be used. * @param trans The MsnTransaction to be sent. */ -void msn_cmdproc_send_trans(MsnCmdProc *cmdproc, MsnTransaction *trans); +gboolean msn_cmdproc_send_trans(MsnCmdProc *cmdproc, MsnTransaction *trans); /** * Add a transaction to the queue to be processed latter.
--- a/libpurple/protocols/msn/session.c Sat Aug 13 21:57:35 2011 +0000 +++ b/libpurple/protocols/msn/session.c Sun Aug 14 19:04:59 2011 +0000 @@ -263,8 +263,10 @@ { swboard = msn_switchboard_new(session); swboard->im_user = g_strdup(username); - msn_switchboard_request(swboard); - msn_switchboard_request_add_user(swboard, username); + if (msn_switchboard_request(swboard)) + msn_switchboard_request_add_user(swboard, username); + else + return NULL; } swboard->flag |= flag;
--- a/libpurple/protocols/msn/switchboard.c Sat Aug 13 21:57:35 2011 +0000 +++ b/libpurple/protocols/msn/switchboard.c Sun Aug 14 19:04:59 2011 +0000 @@ -421,9 +421,10 @@ purple_debug_info("msn", "unqueuing unsent message to %s\n", swboard->im_user); - msn_switchboard_request(swboard); - msn_switchboard_request_add_user(swboard, swboard->im_user); - swboard->reconn_timeout_h = 0; + if (msn_switchboard_request(swboard)) { + msn_switchboard_request_add_user(swboard, swboard->im_user); + swboard->reconn_timeout_h = 0; + } return FALSE; } @@ -1078,7 +1079,7 @@ swboard_error_helper(swboard, reason, swboard->im_user); } -void +gboolean msn_switchboard_request(MsnSwitchBoard *swboard) { MsnCmdProc *cmdproc; @@ -1094,7 +1095,7 @@ msn_transaction_set_data(trans, swboard); msn_transaction_set_error_cb(trans, xfr_error); - msn_cmdproc_send_trans(cmdproc, trans); + return msn_cmdproc_send_trans(cmdproc, trans); } void
--- a/libpurple/protocols/msn/switchboard.h Sat Aug 13 21:57:35 2011 +0000 +++ b/libpurple/protocols/msn/switchboard.h Sun Aug 14 19:04:59 2011 +0000 @@ -250,7 +250,7 @@ gboolean msn_switchboard_chat_leave(MsnSwitchBoard *swboard); gboolean msn_switchboard_chat_invite(MsnSwitchBoard *swboard, const char *who); -void msn_switchboard_request(MsnSwitchBoard *swboard); +gboolean msn_switchboard_request(MsnSwitchBoard *swboard); void msn_switchboard_request_add_user(MsnSwitchBoard *swboard, const char *user); /**