# HG changeset patch # User Ka-Hing Cheung # Date 1218092852 0 # Node ID 7b2fdeb078cde6e7561930b240d7b355d104de71 # Parent 4de9cd2a4af26f091754959b88d2f146d9879c5d take an extra reference to PurpleXfer so we can check whether the whole thing went away. I haven't tested this because it's late, but it shouldn't break things or at least shouldn't make things worse. It would be great if someone can test this and let me know. References #6246 diff -r 4de9cd2a4af2 -r 7b2fdeb078cd libpurple/protocols/msn/slpcall.c --- a/libpurple/protocols/msn/slpcall.c Thu Aug 07 06:16:57 2008 +0000 +++ b/libpurple/protocols/msn/slpcall.c Thu Aug 07 07:07:32 2008 +0000 @@ -97,8 +97,10 @@ if (slpcall->end_cb != NULL) slpcall->end_cb(slpcall, session); - if (slpcall->xfer != NULL) + if (slpcall->xfer != NULL) { + slpcall->xfer->data = NULL; purple_xfer_unref(slpcall->xfer); + } g_free(slpcall); } diff -r 4de9cd2a4af2 -r 7b2fdeb078cd libpurple/protocols/msn/slpcall.h --- a/libpurple/protocols/msn/slpcall.h Thu Aug 07 06:16:57 2008 +0000 +++ b/libpurple/protocols/msn/slpcall.h Thu Aug 07 07:07:32 2008 +0000 @@ -25,6 +25,7 @@ #define _MSN_SLPCALL_H_ #include "internal.h" +#include "ft.h" typedef struct _MsnSlpCall MsnSlpCall; @@ -70,7 +71,7 @@ /* Can be checksum, or smile */ char *data_info; - void *xfer; + PurpleXfer *xfer; MsnSlpCb cb; void (*end_cb)(MsnSlpCall *slpcall, MsnSession *session); diff -r 4de9cd2a4af2 -r 7b2fdeb078cd libpurple/protocols/msn/slplink.c --- a/libpurple/protocols/msn/slplink.c Thu Aug 07 06:16:57 2008 +0000 +++ b/libpurple/protocols/msn/slplink.c Thu Aug 07 07:07:32 2008 +0000 @@ -536,10 +536,17 @@ if (xfer != NULL) { - purple_xfer_start(slpmsg->slpcall->xfer, - 0, NULL, 0); - slpmsg->fp = ((PurpleXfer *)slpmsg->slpcall->xfer)->dest_fp; - xfer->dest_fp = NULL; /* Disable double fclose() */ + purple_xfer_ref(xfer); + purple_xfer_start(xfer, 0, NULL, 0); + + if (xfer->data == NULL) { + purple_xfer_unref(xfer); + return; + } else { + purple_xfer_unref(xfer); + slpmsg->fp = xfer->dest_fp; + xfer->dest_fp = NULL; /* Disable double fclose() */ + } } } }