diff libpurple/protocols/msnp9/slplink.c @ 23727:7eeb81cbbcae

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)
author Ka-Hing Cheung <khc@hxbc.us>
date Thu, 07 Aug 2008 19:47:23 +0000
parents 79b4a8e0da77
children c4aeea36c77b
line wrap: on
line diff
--- 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() */
+						}
 					}
 				}
 			}