/soc/2013/ashmew2/filetransferY: 7b63b8726071: Crash fixed. Was ...

Ashish Gupta ashmew2 at gmail.com
Sun Dec 22 04:25:22 EST 2013


Changeset: 7b63b8726071b2a3df37e1988d2c60f66ad0f437
Author:	 Ashish Gupta <ashmew2 at gmail.com>
Date:	 2013-12-22 14:54 +0530
Branch:	 filetransferX
URL: https://hg.pidgin.im/soc/2013/ashmew2/filetransferY/rev/7b63b8726071

Description:

Crash fixed. Was caused due to iq_callback not set up properly

diffstat:

 libpurple/protocols/jabber/google/google_session.c |  46 +++++++++++++++++++--
 1 files changed, 40 insertions(+), 6 deletions(-)

diffs (134 lines):

diff --git a/libpurple/protocols/jabber/google/google_session.c b/libpurple/protocols/jabber/google/google_session.c
--- a/libpurple/protocols/jabber/google/google_session.c
+++ b/libpurple/protocols/jabber/google/google_session.c
@@ -120,6 +120,7 @@ google_session_destroy(GoogleSession *se
 {
 	GoogleAVSessionData *session_data =
 		(GoogleAVSessionData *) session->session_data;
+	
 	JabberStream *js = session->js;
 
 	session->state = TERMINATED;	
@@ -127,14 +128,28 @@ google_session_destroy(GoogleSession *se
 
 	if(!session_data)
 		purple_debug_info("google_session","Session_data is NULL..\n");
+	else
+		purple_debug_info("google_session", "Session_data is NOT NULL..\n");
+	
+	purple_debug_info("google_session", "google_session_destroy] session's address : %u\n",session);	
+	purple_debug_info("google_session", "google_session_destroy] session_data's address : %u\n",session_data);
+	purple_debug_info("google_session", "google_session_destroy] session_data's address : %u\n",session->session_data);
+	
+	if(session_data->share)
+		purple_debug_info("google_session", "Share found!\n");
+	else
+		purple_debug_info("google_session", "Share NOT found!\n");		
+
+
 
 	if(session_data->share) {
+		purple_debug_info("google_session", "Session_data->share Block..\n");				
 		GoogleXferSessionData *share_session = session_data->share_session;
 		GSList *temp = NULL;
 		
 		purple_debug_info("google_session", "Destroying The current Google Session..\n");
-
-		/*Xfer section needs fixing...TODO : Remve this block
+		
+		/*Xfer section needs fixing...TODO : Remove this block
 		purple_debug_info("google_session", "Trying to kill xfer..BEFORE?\n");
 		purple_debug_info("gs_", "status of xfer : %d",purple_xfer_get_status(share_session->xfer) == PURPLE_XFER_STATUS_STARTED);
 		TODO: Add various status changes when cancelling Xfers so that the following section can make use of it.
@@ -197,6 +212,9 @@ google_session_destroy(GoogleSession *se
 		g_free(share_session);		
 		g_free(temp);		
 	}
+	else
+		purple_debug_info("google_session", "share_session is not share!");
+	
 	purple_debug_info("google_session", "Phase -1\n");
 
 	js->google_share_sessions = g_list_remove(js->google_share_sessions,session);
@@ -517,8 +535,13 @@ gtalk_xfer_send_terminate(PurpleXfer *xf
 	purple_debug_info("google_session", "Inside gtalk_xfer_send_terminate, xfer_status : %d\n",
 			  purple_xfer_get_status(xfer));
 
-	if(session->state < IN_PROGRESS)		
+	purple_debug_info("google_session", "gtalk_xfer_send_terminate] session's address : %u\n",session);	
+	purple_debug_info("google_session", "gtalk_xfer_send_terminate] session->session_data's address : %u\n",session->session_data);	
+
+	if(session->state < IN_PROGRESS) {
+		purple_debug_info("google_session", "Directly calling destroy().. as state<IN_PROGRESS..\n");
 		google_session_destroy(session);
+	}
 	else {
 		xmlnode_set_attrib(iq->node, "to", session->remote_jid);	
 		session_node = xmlnode_new_child(iq->node, "session");
@@ -527,8 +550,9 @@ gtalk_xfer_send_terminate(PurpleXfer *xf
 		xmlnode_set_attrib(session_node, "initiator", session->id.initiator);
 		xmlnode_set_namespace(session_node, NS_GOOGLE_SESSION);        
 		purple_debug_info("google_session", "Sending google_s_dest as callback..Sending IQ\n");
-		jabber_iq_set_callback(iq, google_session_destroy, session);
+		purple_debug_info("google_session", "gtalk_xfer_send_terminate] xfer->data's address : %u\n",xfer->data);	
 		jabber_iq_send(iq);       	
+		google_session_destroy(session);
 	}
 }
 
@@ -563,6 +587,9 @@ gint gtalk_xfer_init_agent(GoogleSession
 	GoogleXferSessionData *share_session = session_data->share_session;
 		
 	purple_debug_info("google_session", "Inside gtalk_xfer_init_agent\n");
+	purple_debug_info("google_session", "gtalk_xfer_init_agent] session_data's address : %u\n",session_data);
+	purple_debug_info("google_session", "gtalk_xfer_init_agent] ->session_data's address : %u\n",session->session_data);	
+
 	if(!share_session)
 		return -1;
 
@@ -1183,6 +1210,8 @@ google_session_handle_transport_accept(J
 {
 	JabberIq *result_iq = jabber_iq_new(js,JABBER_IQ_RESULT);
 	purple_debug_info("google_session", "Inside handle_transport_accept()\n");
+	purple_debug_info("google_session", "google_session_handle_transport_accept] session->session_data's address : %u\n",session->session_data);	
+
 	xmlnode_set_attrib(result_iq->node, "to", session->remote_jid);
 	jabber_iq_set_id(result_iq, iq_id);	
 	jabber_iq_send(result_iq);
@@ -2094,6 +2123,9 @@ gtalk_xfer_new_session(JabberStream *js,
 	session->state = UNINIT; /*TODO: Add similar state changes in the code for GoogleSession*/
 	session->js = js;
 	session->remote_jid = g_strdup(jid);
+	purple_debug_info("google_session", "gtalk_xfer_new_session] session_data's address : %u\n",session_data);
+	purple_debug_info("google_session", "gtalk_xfer_new_session] session_data's address : %u\n",session->session_data);
+
 	return session;
 }
 
@@ -2203,7 +2235,7 @@ void gtalk_xfer_send_session_initiate(Pu
 				    js->user->resource);
 
 	purple_debug_info("google_session", "Inside gtalk_xfer_send_session_initiate()\n");
-
+	purple_debug_info("google_session", "gtalk_xfer_send_session_initiate] session_data's address : %u\n",session->session_data);
 	iq = jabber_iq_new(js, JABBER_IQ_SET);
 	xmlnode_set_attrib(iq->node, "to", session->remote_jid);
 
@@ -2250,7 +2282,6 @@ void gtalk_xfer_send_session_initiate(Pu
 	jabber_iq_send(iq);
 	purple_debug_info("google_session", "Initiate SENT!");
 	session->state = SENT_INITIATE;
-
 }
 
 void
@@ -2300,6 +2331,9 @@ gtalk_xfer_init(PurpleXfer *xfer)
 	JabberStream *js = session->js;
 
 	purple_debug_info("google_session", "Inside gtalk_xfer_init\n");
+	purple_debug_info("google_session", "gtalk_xfer_send_session_initiate] session_data's address : %u\n",session_data);
+	purple_debug_info("google_session", "gtalk_xfer_send_session_initiate] session->session_data's address : %u\n",session->session_data);	
+
 	js->google_share_sessions = g_list_prepend(js->google_share_sessions, session);
 
 	if(purple_xfer_get_type(xfer) == PURPLE_XFER_RECEIVE)



More information about the Commits mailing list