diff src/protocols/jabber/chat.c @ 8396:387ba791d5f9

[gaim-migrate @ 9125] fix a crash in jabber chats when you leave the chat before closing the configuration dialog, and plug a memleak. Thanks deryni for pointing the crash out committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Thu, 04 Mar 2004 17:07:56 +0000
parents 7b57c3bd9db6
children 0383e55cd658
line wrap: on
line diff
--- a/src/protocols/jabber/chat.c	Thu Mar 04 05:47:41 2004 +0000
+++ b/src/protocols/jabber/chat.c	Thu Mar 04 17:07:56 2004 +0000
@@ -229,6 +229,12 @@
 
 	g_hash_table_remove(js->chats, jabber_normalize(NULL, room_jid));
 	g_free(room_jid);
+}
+
+void jabber_chat_free(JabberChat *chat)
+{
+	if(chat->config_dialog_handle)
+		gaim_request_close(chat->config_dialog_type, chat->config_dialog_handle);
 
 	g_free(chat->room);
 	g_free(chat->server);
@@ -314,7 +320,8 @@
 				continue;
 
 			if(!strcmp(xmlns, "jabber:x:data")) {
-				jabber_x_data_request(js, x, jabber_chat_room_configure_x_data_cb, chat);
+				chat->config_dialog_type = GAIM_REQUEST_FIELDS;
+				chat->config_dialog_handle = jabber_x_data_request(js, x, jabber_chat_room_configure_x_data_cb, chat);
 				return;
 			}
 		}
@@ -358,6 +365,8 @@
 	if(!chat)
 		return;
 
+	chat->config_dialog_handle = NULL;
+
 	if(!chat->muc) {
 		gaim_notify_error(chat->js->gc, _("Room Configuration Error"), _("Room Configuration Error"),
 				_("This room is not capable of being configured"));
@@ -386,6 +395,8 @@
 	if(!chat)
 		return;
 
+	chat->config_dialog_handle = NULL;
+
 	iq = jabber_iq_new_query(chat->js, JABBER_IQ_SET,
 			"http://jabber.org/protocol/muc#owner");
 	query = xmlnode_get_child(iq->node, "query");