Mercurial > pidgin.yaz
comparison src/conversation.c @ 4638:b58c08b7cbe4
[gaim-migrate @ 4946]
This should fix the "Closing a window with chats causes gaim to go kab00m"
bug. Please test it.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Sun, 02 Mar 2003 23:02:25 +0000 |
parents | 56dde5f7d3a8 |
children | ba87412b1a57 |
comparison
equal
deleted
inserted
replaced
4637:bf89c7598989 | 4638:b58c08b7cbe4 |
---|---|
38 | 38 |
39 struct ConvPlacementData | 39 struct ConvPlacementData |
40 { | 40 { |
41 char *name; | 41 char *name; |
42 gaim_conv_placement_fnc fnc; | 42 gaim_conv_placement_fnc fnc; |
43 | |
44 }; | 43 }; |
45 | 44 |
46 #define SEND_TYPED_TIMEOUT 5000 | 45 #define SEND_TYPED_TIMEOUT 5000 |
47 | 46 |
48 static struct gaim_window_ui_ops *win_ui_ops = NULL; | 47 static struct gaim_window_ui_ops *win_ui_ops = NULL; |
462 if (win == NULL) | 461 if (win == NULL) |
463 return; | 462 return; |
464 | 463 |
465 ops = gaim_window_get_ui_ops(win); | 464 ops = gaim_window_get_ui_ops(win); |
466 | 465 |
467 for (node = g_list_first(gaim_window_get_conversations(win)); | 466 /* |
468 node != NULL; | 467 * If there are any conversations in this, destroy them all. The last |
469 node = g_list_next(node)) | 468 * conversation will call gaim_window_destroy(), but this time, this |
469 * check will fail and the window will actually be destroyed. | |
470 * | |
471 * This is needed because chats may not close right away. They may | |
472 * wait for notification first. When they get that, the window is | |
473 * already destroyed, and gaim either crashes or spits out gtk warnings. | |
474 * The problem is fixed with this check. | |
475 */ | |
476 if (gaim_window_get_conversation_count(win) > 0) { | |
477 | |
478 for (node = g_list_first(gaim_window_get_conversations(win)); | |
479 node != NULL; | |
480 node = g_list_next(node)) | |
481 { | |
482 struct gaim_conversation *conv; | |
483 | |
484 conv = (struct gaim_conversation *)node->data; | |
485 | |
486 gaim_conversation_destroy(conv); | |
487 } | |
488 } | |
489 else | |
470 { | 490 { |
471 struct gaim_conversation *conv; | 491 if (ops != NULL && ops->destroy_window != NULL) |
472 | 492 ops->destroy_window(win); |
473 conv = (struct gaim_conversation *)node->data; | 493 |
474 | 494 g_list_free(gaim_window_get_conversations(win)); |
475 conv->window = NULL; | 495 |
476 gaim_conversation_destroy(conv); | 496 windows = g_list_remove(windows, win); |
477 | 497 |
478 node->data = NULL; | 498 g_free(win); |
479 } | 499 } |
480 | |
481 if (ops != NULL && ops->destroy_window != NULL) | |
482 ops->destroy_window(win); | |
483 | |
484 g_list_free(gaim_window_get_conversations(win)); | |
485 | |
486 windows = g_list_remove(windows, win); | |
487 | |
488 g_free(win); | |
489 } | 500 } |
490 | 501 |
491 void | 502 void |
492 gaim_window_show(struct gaim_window *win) | 503 gaim_window_show(struct gaim_window *win) |
493 { | 504 { |
957 * | 968 * |
958 * Long paragraph. <-- Short sentence. | 969 * Long paragraph. <-- Short sentence. |
959 * | 970 * |
960 * -- ChipX86 | 971 * -- ChipX86 |
961 */ | 972 */ |
973 | |
962 if (gc && g_slist_find(gc->buddy_chats, conv) != NULL) { | 974 if (gc && g_slist_find(gc->buddy_chats, conv) != NULL) { |
963 serv_chat_leave(gc, gaim_chat_get_id(GAIM_CHAT(conv))); | 975 serv_chat_leave(gc, gaim_chat_get_id(GAIM_CHAT(conv))); |
964 | 976 |
965 return; | 977 return; |
966 } | 978 } |