pidgin: dfd110ca: jabber: Don't crash when disconnecting i...

darkrain42 at pidgin.im darkrain42 at pidgin.im
Tue Sep 29 12:26:05 EDT 2009


-----------------------------------------------------------------
Revision: dfd110ca48604f96874c09efb2064228e62475f8
Ancestor: 903af32836ce489b57aec5f255ba91e9e675526f
Author: darkrain42 at pidgin.im
Date: 2009-09-28T22:11:54
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/dfd110ca48604f96874c09efb2064228e62475f8

Modified files:
        libpurple/protocols/jabber/bosh.c

ChangeLog: 

jabber: Don't crash when disconnecting if there's been no response from the server.

PurpleBOSHConnection.sid is only set after we've received a resposne from
the server, so if we try to send a 'terminate' before we have a response,
it will crash on Win32 (NULL printf), plus it's wrong anyway.

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/bosh.c	85feb2be20ee6f4488b71baec8a3d6a11636cdcb
+++ libpurple/protocols/jabber/bosh.c	b43b74f09fc9797da28aa19d5ccf9c9936d11cdb
@@ -401,7 +401,8 @@ void jabber_bosh_connection_close(Purple
 
 void jabber_bosh_connection_close(PurpleBOSHConnection *conn)
 {
-	jabber_bosh_connection_send(conn, PACKET_TERMINATE, NULL);
+	if (conn->state == BOSH_CONN_ONLINE)
+		jabber_bosh_connection_send(conn, PACKET_TERMINATE, NULL);
 }
 
 static gboolean jabber_bosh_connection_error_check(PurpleBOSHConnection *conn, xmlnode *node) {


More information about the Commits mailing list