cpw.malu.xmpp.jingle_ft: 74fb885d: Fix a couple of crashers when cancelling...

malu at pidgin.im malu at pidgin.im
Thu Jun 11 14:10:29 EDT 2009


-----------------------------------------------------------------
Revision: 74fb885d02f9d13a9469aee9348aa0020319e274
Ancestor: 649e26b5203399ed4bd576a30bac61961e3470c1
Author: malu at pidgin.im
Date: 2009-06-11T18:03:27
Branch: im.pidgin.cpw.malu.xmpp.jingle_ft
URL: http://d.pidgin.im/viewmtn/revision/info/74fb885d02f9d13a9469aee9348aa0020319e274

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

ChangeLog: 

Fix a couple of crashers when cancelling a transfer

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/jingle/file-transfer.c	359fdc457fe335b865dc64ef9bba4c6b3353a47f
+++ libpurple/protocols/jabber/jingle/file-transfer.c	388bc00eea5d622ba62bce7ac1082bea09ac4c81
@@ -609,15 +609,20 @@ jingle_file_transfer_cancel_send(PurpleX
 {
 	JingleContent *content = (JingleContent *) xfer->data;
 	JingleSession *session = jingle_content_get_session(content);
-	JingleTransport *transport = jingle_content_get_transport(content);
 
-	if (JINGLE_IS_S5B(transport)) {
-		jingle_s5b_stop_connection_attempts(JINGLE_S5B(transport));
-	}
+	if (session) {
+		JingleTransport *transport = jingle_content_get_transport(content);
 
-	purple_debug_info("jingle-ft", "jingle_file_transfer_cancel_send\n");
-	jabber_iq_send(jingle_session_to_packet(session, JINGLE_SESSION_TERMINATE));
-	g_object_unref(transport);
+		if (JINGLE_IS_S5B(transport)) {
+			jingle_s5b_stop_connection_attempts(JINGLE_S5B(transport));
+		}
+
+		purple_debug_info("jingle-ft", "jingle_file_transfer_cancel_send\n");
+		jabber_iq_send(jingle_session_to_packet(session, JINGLE_SESSION_TERMINATE));
+		g_object_unref(transport);
+		/* disassociate xfer from session */
+		JINGLE_FT(content)->priv->xfer = NULL;
+	}
 	g_object_unref(session);
 	g_object_unref(session);
 }
@@ -627,15 +632,20 @@ jingle_file_transfer_cancel_recv(PurpleX
 {
 	JingleContent *content = (JingleContent *) xfer->data;
 	JingleSession *session = jingle_content_get_session(content);
-	JingleTransport *transport = jingle_content_get_transport(content);
 
-	if (JINGLE_IS_S5B(transport)) {
-		jingle_s5b_stop_connection_attempts(JINGLE_S5B(transport));
-	}
+	if (session) {
+		JingleTransport *transport = jingle_content_get_transport(content);
 
-	purple_debug_info("jingle-ft", "jingle_file_transfer_cancel_recv\n");
-	jabber_iq_send(jingle_session_to_packet(session, JINGLE_SESSION_TERMINATE));
-	g_object_unref(transport);
+		if (JINGLE_IS_S5B(transport)) {
+			jingle_s5b_stop_connection_attempts(JINGLE_S5B(transport));
+		}
+
+		purple_debug_info("jingle-ft", "jingle_file_transfer_cancel_recv\n");
+		jabber_iq_send(jingle_session_to_packet(session, JINGLE_SESSION_TERMINATE));
+		g_object_unref(transport);
+		/* disassociate xfer from session */
+		JINGLE_FT(content)->priv->xfer = NULL;
+	}
 	g_object_unref(session);
 	g_object_unref(session);
 }


More information about the Commits mailing list