changeset 23719:7b2fdeb078cd

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
author Ka-Hing Cheung <khc@hxbc.us>
date Thu, 07 Aug 2008 07:07:32 +0000
parents 4de9cd2a4af2
children 7e2e4d3abd59
files libpurple/protocols/msn/slpcall.c libpurple/protocols/msn/slpcall.h libpurple/protocols/msn/slplink.c
diffstat 3 files changed, 16 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- 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);
 }
--- 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);
--- 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() */
+						}
 					}
 				}
 			}