# HG changeset patch # User Luke Schierer # Date 1051678149 0 # Node ID 799f9585988a7f6e077908583a265dda69323b99 # Parent 19f2672345926fcd3f3d1a2ee29773a5c7194f7c [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 diff -r 19f267234592 -r 799f9585988a src/conversation.c --- 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; + } } }