pidgin: 30084745: take an extra reference to PurpleXfer so...

khc at pidgin.im khc at pidgin.im
Thu Aug 7 03:10:48 EDT 2008


-----------------------------------------------------------------
Revision: 3008474548ddd234f222ed5a0be3066e2ea0da0b
Ancestor: 4b9926507f55072d828a28b682b7f4a2c7cbe9d6
Author: khc at pidgin.im
Date: 2008-08-07T07:07:32
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/3008474548ddd234f222ed5a0be3066e2ea0da0b

Modified files:
        libpurple/protocols/msn/slpcall.c
        libpurple/protocols/msn/slpcall.h
        libpurple/protocols/msn/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.

It would be great if someone can test this and let me know.

References #6246

-------------- next part --------------
============================================================
--- libpurple/protocols/msn/slpcall.c	7e75e4d97135dd1491b92eab20779a223b6f7f77
+++ libpurple/protocols/msn/slpcall.c	0693f0ff344eb7259e2ad49d1d3d177488f03779
@@ -97,8 +97,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/msn/slpcall.h	aea1be5c206e45484a0368b4169976d29a68cd97
+++ libpurple/protocols/msn/slpcall.h	182530c5534fec9303e8806770d905f1ad709769
@@ -25,6 +25,7 @@
 #define _MSN_SLPCALL_H_
 
 #include "internal.h"
+#include "ft.h"
 
 typedef struct _MsnSlpCall MsnSlpCall;
 
@@ -70,7 +71,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/msn/slplink.c	5d58b24c3c2fc25028c74a4eca2338dc3b979daa
+++ libpurple/protocols/msn/slplink.c	c7e2871c74280a7547b20a08c662077dfccacb84
@@ -536,10 +536,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