--- a/libpurple/protocols/msn/slplink.c Sat May 22 06:27:18 2010 +0000 +++ b/libpurple/protocols/msn/slplink.c Wed May 26 19:47:56 2010 +0000 @@ -101,8 +101,11 @@ session = slplink->session; - if (slplink->dc != NULL) + if (slplink->dc != NULL) { + slplink->dc->slplink = NULL; msn_dc_destroy(slplink->dc); + slplink->dc = NULL; + } while (slplink->slp_calls != NULL) msn_slpcall_destroy(slplink->slp_calls->data); @@ -203,12 +206,16 @@ /* The slplink has no slpcalls in it, release it from MSN_SB_FLAG_FT. * If nothing else is using it then this might cause swboard to be * destroyed. */ - if (slplink->slp_calls == NULL && slplink->swboard != NULL) + if (slplink->slp_calls == NULL && slplink->swboard != NULL) { msn_switchboard_release(slplink->swboard, MSN_SB_FLAG_FT); + slplink->swboard = NULL; + } /* The slplink has no slpcalls in it, release it from the DC. */ - if (slplink->slp_calls == NULL && slplink->dc != NULL) + if (slplink->slp_calls == NULL && slplink->dc != NULL) { msn_dc_destroy(slplink->dc); + slplink->dc = NULL; + } } MsnSlpCall * @@ -315,7 +322,7 @@ #endif slpmsg->msgs = - g_list_append(slpmsg->msgs, msg); + g_list_append(slpmsg->msgs, msn_message_ref(msg)); msn_slplink_send_msg(slplink, msg); if ((slpmsg->flags == 0x20 || slpmsg->flags == 0x1000020 || @@ -374,6 +381,8 @@ } } } + + msn_message_unref(msg); } /* We have received the message nak. */ @@ -387,6 +396,7 @@ msn_slplink_send_msgpart(slpmsg->slplink, slpmsg); slpmsg->msgs = g_list_remove(slpmsg->msgs, msg); + msn_message_unref(msg); } static void