comparison src/conversation.c @ 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 1cf4eb75e3ee
children a6146cbae03b
comparison
equal deleted inserted replaced
5261:19f267234592 5262:799f9585988a
948 win = gaim_conversation_get_window(conv); 948 win = gaim_conversation_get_window(conv);
949 ops = gaim_conversation_get_ui_ops(conv); 949 ops = gaim_conversation_get_ui_ops(conv);
950 gc = gaim_conversation_get_gc(conv); 950 gc = gaim_conversation_get_gc(conv);
951 name = gaim_conversation_get_name(conv); 951 name = gaim_conversation_get_name(conv);
952 952
953 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); 953 if (gc) {
954 954 /* Still connected */
955 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { 955 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
956 if (!(misc_options & OPT_MISC_STEALTH_TYPING)) 956
957 serv_send_typing(gc, (char *)name, NOT_TYPING); 957 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) {
958 958 if (!(misc_options & OPT_MISC_STEALTH_TYPING))
959 if (gc && prpl_info->convo_closed != NULL) 959 serv_send_typing(gc, (char *)name, NOT_TYPING);
960 prpl_info->convo_closed(gc, (char *)name); 960
961 } 961 if (gc && prpl_info->convo_closed != NULL)
962 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) { 962 prpl_info->convo_closed(gc, (char *)name);
963 /* 963 }
964 * This is unfortunately necessary, because calling serv_chat_leave() 964 else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) {
965 * calls this gaim_conversation_destroy(), which leads to two calls 965 /*
966 * here.. We can't just return after this, because then it'll return 966 * This is unfortunately necessary, because calling serv_chat_leave()
967 * on the next pass. So, since serv_got_chat_left(), which is 967 * calls this gaim_conversation_destroy(), which leads to two calls
968 * eventually called from the prpl that serv_chat_leave() calls, 968 * here.. We can't just return after this, because then it'll return
969 * removes this conversation from the gc's buddy_chats list, we're 969 * on the next pass. So, since serv_got_chat_left(), which is
970 * going to check to see if this exists in the list. If so, we want 970 * eventually called from the prpl that serv_chat_leave() calls,
971 * to return after calling this, because it'll be called again. If not, 971 * removes this conversation from the gc's buddy_chats list, we're
972 * fall through, because it'll have already been removed, and we'd 972 * going to check to see if this exists in the list. If so, we want
973 * be on the 2nd pass. 973 * to return after calling this, because it'll be called again. If not,
974 * 974 * fall through, because it'll have already been removed, and we'd
975 * Long paragraph. <-- Short sentence. 975 * be on the 2nd pass.
976 * 976 *
977 * -- ChipX86 977 * Long paragraph. <-- Short sentence.
978 */ 978 *
979 979 * -- ChipX86
980 if (gc && g_slist_find(gc->buddy_chats, conv) != NULL) { 980 */
981 serv_chat_leave(gc, gaim_chat_get_id(GAIM_CHAT(conv))); 981
982 982 if (gc && g_slist_find(gc->buddy_chats, conv) != NULL) {
983 return; 983 serv_chat_leave(gc, gaim_chat_get_id(GAIM_CHAT(conv)));
984
985 return;
986 }
984 } 987 }
985 } 988 }
986 989
987 gaim_event_broadcast(event_del_conversation, conv); 990 gaim_event_broadcast(event_del_conversation, conv);
988 991