cpw.malu.xmpp.jingle_ft: 7c6d3e92: Should now finalize the transport for a ...

malu at pidgin.im malu at pidgin.im
Thu Mar 19 20:20:33 EDT 2009


-----------------------------------------------------------------
Revision: 7c6d3e9221035e2cab456dfebb95b5ccfce6818e
Ancestor: 27ab67a60d79208aab5ec298d1a09013f2173ca9
Author: malu at pidgin.im
Date: 2009-03-20T00:17:06
Branch: im.pidgin.cpw.malu.xmpp.jingle_ft
URL: http://d.pidgin.im/viewmtn/revision/info/7c6d3e9221035e2cab456dfebb95b5ccfce6818e

Modified files:
        libpurple/protocols/jabber/jingle/file-transfer.c
        libpurple/protocols/jabber/jingle/ibbs.c

ChangeLog: 

Should now finalize the transport for a file transfer
Cancelling now works for the initiator, the receiver still crashes when
the transfer is closed mid-stream, though...

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/jingle/file-transfer.c	cea21182f747218a0f18f0b868c94e72116498e0
+++ libpurple/protocols/jabber/jingle/file-transfer.c	d328f6e292efff393ad33dcb98d4f2d738bf1910
@@ -120,6 +120,8 @@ jingle_file_transfer_finalize (GObject *
 		/* remove reference in transfer */
 		priv->xfer->data = NULL;
 	}
+	
+	G_OBJECT_CLASS(parent_class)->finalize(ft);
 }
 
 static void
@@ -243,9 +245,8 @@ jingle_file_transfer_ibb_send_data(Jingl
 	PurpleXfer *xfer = JINGLE_FT_GET_PRIVATE(JINGLE_FT(content))->xfer;
 	FILE *fp = JINGLE_FT_GET_PRIVATE(JINGLE_FT(content))->ibb_fp;
 	gsize remaining = purple_xfer_get_bytes_remaining(xfer);
-	gsize block_size = 
-		jingle_ibb_get_block_size(JINGLE_IBB(
-			jingle_content_get_transport(content)));
+	JingleTransport *transport = jingle_content_get_transport(content);
+	gsize block_size = jingle_ibb_get_block_size(JINGLE_IBB(transport));
 	gsize packet_size = remaining < block_size ? remaining : block_size;
 	gpointer data = g_malloc(packet_size);
 	int res;
@@ -256,8 +257,7 @@ jingle_file_transfer_ibb_send_data(Jingl
 	res = fread(data, packet_size, 1, fp);
 
 	if (res == 1) {
-		jingle_ibb_send_data(JINGLE_IBB(jingle_content_get_transport(content)),
-			data, packet_size);
+		jingle_ibb_send_data(JINGLE_IBB(transport), data, packet_size);
 		purple_xfer_set_bytes_sent(xfer,
 			purple_xfer_get_bytes_sent(xfer) + packet_size);
 		purple_xfer_update_progress(xfer);
@@ -265,6 +265,7 @@ jingle_file_transfer_ibb_send_data(Jingl
 		jingle_file_transfer_cancel_local(content);
 	}
 	g_free(data);
+	g_object_unref(transport);
 }
 
 /* callback functions for IBB */
@@ -362,6 +363,7 @@ jingle_file_transfer_xfer_init(PurpleXfe
 				purple_xfer_cancel_remote(xfer);
 				jabber_iq_send(jingle_session_to_packet(session,
 						JINGLE_SESSION_TERMINATE));
+				g_object_unref(transport);
 				g_object_unref(session);
 				g_object_unref(session);
 				return;
@@ -378,6 +380,7 @@ jingle_file_transfer_xfer_init(PurpleXfe
 		}
 	}
 	g_object_unref(session);
+	g_object_unref(transport);
 }
 
 static void
@@ -472,6 +475,7 @@ jingle_file_transfer_handle_action_inter
 			}
 			
 			g_object_unref(session);
+			g_object_unref(transport);
 			break;
 		}
 		case JINGLE_SESSION_INITIATE: {
@@ -540,7 +544,6 @@ jingle_file_transfer_handle_action_inter
 			}
 	
 			g_object_unref(session);
-			g_object_unref(session);
 			break;
 		}
 		case JINGLE_TRANSPORT_INFO: {
============================================================
--- libpurple/protocols/jabber/jingle/ibbs.c	e3b32fee9d586f0deb3a99fecc5efcfffd84bf3a
+++ libpurple/protocols/jabber/jingle/ibbs.c	92b6c31344d220be53b6edb2ec223f40f26b49d9
@@ -206,6 +206,7 @@ jingle_ibb_data_sent_callback(JabberIBBS
 		if (sent_cb) {
 			sent_cb(content);
 		}
+		g_object_unref(transport);
 	}
 }
 
@@ -225,6 +226,7 @@ jingle_ibb_data_recv_callback(JabberIBBS
 		if (recv_cb) {
 			recv_cb(content, data, size);
 		}
+		g_object_unref(transport);
 	}
 }
 
@@ -243,6 +245,7 @@ jingle_ibb_error_callback(JabberIBBSessi
 		if (error_cb) {
 			error_cb(content);
 		}
+		g_object_unref(transport);
 	}
 }
 


More information about the Commits mailing list