# HG changeset patch # User Ka-Hing Cheung # Date 1218138443 0 # Node ID 7eeb81cbbcae9dcb93f947f0af3da9ff5cf10c4b # Parent 76d03e424f826c759ab3a940f17cccb644989a8c 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. (Michal Marek tested this and said it works, so I am porting this to msnp9 too) diff -r 76d03e424f82 -r 7eeb81cbbcae libpurple/protocols/msnp9/slpcall.c --- a/libpurple/protocols/msnp9/slpcall.c Thu Aug 07 19:36:12 2008 +0000 +++ b/libpurple/protocols/msnp9/slpcall.c Thu Aug 07 19:47:23 2008 +0000 @@ -120,8 +120,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 76d03e424f82 -r 7eeb81cbbcae libpurple/protocols/msnp9/slpcall.h --- a/libpurple/protocols/msnp9/slpcall.h Thu Aug 07 19:36:12 2008 +0000 +++ b/libpurple/protocols/msnp9/slpcall.h Thu Aug 07 19:47:23 2008 +0000 @@ -25,6 +25,7 @@ #define _MSN_SLPCALL_H_ #include "internal.h" +#include "ft.h" typedef struct _MsnSlpCall MsnSlpCall; @@ -71,7 +72,7 @@ /* Can be checksum, or smile */ char *data_info; - void *xfer; + PurpleXfer *xfer; MsnSlpCb cb; void (*end_cb)(MsnSlpCall *slpcall, MsnSession *session); diff -r 76d03e424f82 -r 7eeb81cbbcae libpurple/protocols/msnp9/slplink.c --- a/libpurple/protocols/msnp9/slplink.c Thu Aug 07 19:36:12 2008 +0000 +++ b/libpurple/protocols/msnp9/slplink.c Thu Aug 07 19:47:23 2008 +0000 @@ -560,10 +560,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() */ + } } } }