pidgin: 521d7478: take an extra reference to PurpleXfer so...

khc at pidgin.im khc at pidgin.im
Thu Aug 7 15:50:51 EDT 2008


-----------------------------------------------------------------
Revision: 521d7478a48ec5109a78fb66eab6ad7ced97c34a
Ancestor: 014e8d15032c5d2f61de756436094429827bb9f6
Author: khc at pidgin.im
Date: 2008-08-07T19:47:23
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/521d7478a48ec5109a78fb66eab6ad7ced97c34a

Modified files:
        libpurple/protocols/msnp9/slpcall.c
        libpurple/protocols/msnp9/slpcall.h
        libpurple/protocols/msnp9/slplink.c

ChangeLog: 

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)



-------------- next part --------------
============================================================
--- libpurple/protocols/msnp9/slpcall.c	1da6a4c73b7623a45bb25957e2b0b54386211e3b
+++ libpurple/protocols/msnp9/slpcall.c	700df0e754c850a4578a6f62dabe91b07a4bc9d9
@@ -120,8 +120,10 @@ msn_slp_call_destroy(MsnSlpCall *slpcall
 	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);
 }
============================================================
--- libpurple/protocols/msnp9/slpcall.h	d2e0eca1cdb4f053fc4085d66c951c10a17adcac
+++ libpurple/protocols/msnp9/slpcall.h	a142eff835ceceff7c3c5136d36ad85503d744ec
@@ -25,6 +25,7 @@
 #define _MSN_SLPCALL_H_
 
 #include "internal.h"
+#include "ft.h"
 
 typedef struct _MsnSlpCall MsnSlpCall;
 
@@ -71,7 +72,7 @@ struct _MsnSlpCall
 	/* Can be checksum, or smile */
 	char *data_info;
 
-	void *xfer;
+	PurpleXfer *xfer;
 
 	MsnSlpCb cb;
 	void (*end_cb)(MsnSlpCall *slpcall, MsnSession *session);
============================================================
--- libpurple/protocols/msnp9/slplink.c	f65596ea173bf7c9c1114edd7599140f470e7788
+++ libpurple/protocols/msnp9/slplink.c	2f6ed0b563df31ac3217180cc8c94efe03f3d1e3
@@ -560,10 +560,17 @@ msn_slplink_process_msg(MsnSlpLink *slpl
 
 					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() */
+						}
 					}
 				}
 			}


More information about the Commits mailing list