changeset 5262:799f9585988a

[gaim-migrate @ 5634] Jose' M^(a) Pe'rez Ca'ncer (jm_pc) writes: " Closing a IM window for which the connection has been lost causes a segfault. The problem is that gaim tries to perform operations on a connection that has been closed and subsequently crashes. This patch avoids doing those operations when the connection has been closed. " committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Wed, 30 Apr 2003 04:49:09 +0000
parents 19f267234592
children b476a30ef4e3
files src/conversation.c
diffstat 1 files changed, 34 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/src/conversation.c	Tue Apr 29 14:45:46 2003 +0000
+++ b/src/conversation.c	Wed Apr 30 04:49:09 2003 +0000
@@ -950,37 +950,40 @@
 	gc   = gaim_conversation_get_gc(conv);
 	name = gaim_conversation_get_name(conv);
 
-	prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
-
-	if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) {
-		if (!(misc_options & OPT_MISC_STEALTH_TYPING))
-			serv_send_typing(gc, (char *)name, NOT_TYPING);
-
-		if (gc && prpl_info->convo_closed != NULL)
-			prpl_info->convo_closed(gc, (char *)name);
-	}
-	else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) {
-		/*
-		 * This is unfortunately necessary, because calling serv_chat_leave()
-		 * calls this gaim_conversation_destroy(), which leads to two calls
-		 * here.. We can't just return after this, because then it'll return
-		 * on the next pass. So, since serv_got_chat_left(), which is
-		 * eventually called from the prpl that serv_chat_leave() calls,
-		 * removes this conversation from the gc's buddy_chats list, we're
-		 * going to check to see if this exists in the list. If so, we want
-		 * to return after calling this, because it'll be called again. If not,
-		 * fall through, because it'll have already been removed, and we'd
-		 * be on the 2nd pass.
-		 *
-		 * Long paragraph. <-- Short sentence.
-		 *
-		 *   -- ChipX86
-		 */
-
-		if (gc && g_slist_find(gc->buddy_chats, conv) != NULL) {
-			serv_chat_leave(gc, gaim_chat_get_id(GAIM_CHAT(conv)));
-
-			return;
+	if (gc) {
+		/* Still connected */
+		prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
+
+		if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) {
+			if (!(misc_options & OPT_MISC_STEALTH_TYPING))
+				serv_send_typing(gc, (char *)name, NOT_TYPING);
+
+			if (gc && prpl_info->convo_closed != NULL)
+				prpl_info->convo_closed(gc, (char *)name);
+		}
+		else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) {
+			/*
+			 * This is unfortunately necessary, because calling serv_chat_leave()
+			 * calls this gaim_conversation_destroy(), which leads to two calls
+			 * here.. We can't just return after this, because then it'll return
+			 * on the next pass. So, since serv_got_chat_left(), which is
+			 * eventually called from the prpl that serv_chat_leave() calls,
+			 * removes this conversation from the gc's buddy_chats list, we're
+			 * going to check to see if this exists in the list. If so, we want
+			 * to return after calling this, because it'll be called again. If not,
+			 * fall through, because it'll have already been removed, and we'd
+			 * be on the 2nd pass.
+			 *
+			 * Long paragraph. <-- Short sentence.
+			 *
+			 *   -- ChipX86
+			 */
+
+			if (gc && g_slist_find(gc->buddy_chats, conv) != NULL) {
+				serv_chat_leave(gc, gaim_chat_get_id(GAIM_CHAT(conv)));
+
+				return;
+			}
 		}
 	}