1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-01 15:26:37 +02:00

Do not clean all GUI objects when crashing after SIGSEGV (this can cause crash inside crash!)

This commit is contained in:
Sebastien Helleu
2008-05-06 17:30:13 +02:00
parent e9603acb1a
commit 72721d7205
7 changed files with 76 additions and 66 deletions
+1 -1
View File
@@ -2175,7 +2175,7 @@ command_upgrade (void *data, struct t_gui_buffer *buffer,
plugin_end ();
/*if (CONFIG_BOOLEAN(config_look_save_on_exit))
(void) config_write (NULL);
gui_main_end ();
gui_main_end (1);
fifo_remove ();
weechat_log_close ();
+1 -1
View File
@@ -122,7 +122,7 @@ debug_sigsegv ()
{
debug_dump (1);
unhook_all ();
gui_main_end ();
gui_main_end (0);
string_iconv_fprintf (stderr, "\n");
string_iconv_fprintf (stderr, "*** Very bad! WeeChat is crashing (SIGSEGV received)\n");
+1 -1
View File
@@ -509,7 +509,7 @@ session_crash (FILE *file, char *message, ...)
va_end (argptr);
fclose (file);
gui_main_end ();
gui_main_end (0);
string_iconv_fprintf (stderr, "Error: %s\n", buf);
string_iconv_fprintf (stderr,
_("Last operation with session file was at position %ld, "
+1 -1
View File
@@ -496,7 +496,7 @@ main (int argc, char *argv[])
plugin_end (); /* end plugin interface(s) */
if (CONFIG_BOOLEAN(config_look_save_on_exit))
(void) config_weechat_write (NULL); /* save WeeChat config file */
gui_main_end (); /* shut down WeeChat GUI */
gui_main_end (1); /* shut down WeeChat GUI */
config_file_free_all (); /* free all configuration files */
gui_keyboard_end (); /* end keyboard */
unhook_all (); /* remove all hooks */
+36 -31
View File
@@ -313,41 +313,46 @@ gui_main_loop ()
/*
* gui_main_end: GUI end
* clean_exit is 0 when WeeChat is crashing (we don't clean
* objects because WeeChat can crash again during this cleanup...)
*/
void
gui_main_end ()
gui_main_end (int clean_exit)
{
/* remove bar items and bars */
gui_bar_item_end ();
gui_bar_free_all ();
/* free clipboard buffer */
if (gui_input_clipboard)
free (gui_input_clipboard);
/* delete all windows */
while (gui_windows)
gui_window_free (gui_windows);
gui_window_tree_free (&gui_windows_tree);
/* delete all buffers */
while (gui_buffers)
gui_buffer_close (gui_buffers, 0);
/* delete global history */
gui_history_global_free ();
/* delete infobar messages */
while (gui_infobar)
gui_infobar_remove ();
/* reset title */
if (CONFIG_BOOLEAN(config_look_set_title))
gui_window_title_reset ();
/* end color */
gui_color_end ();
if (clean_exit)
{
/* remove bar items and bars */
gui_bar_item_end ();
gui_bar_free_all ();
/* free clipboard buffer */
if (gui_input_clipboard)
free (gui_input_clipboard);
/* delete all windows */
while (gui_windows)
gui_window_free (gui_windows);
gui_window_tree_free (&gui_windows_tree);
/* delete all buffers */
while (gui_buffers)
gui_buffer_close (gui_buffers, 0);
/* delete global history */
gui_history_global_free ();
/* delete infobar messages */
while (gui_infobar)
gui_infobar_remove ();
/* reset title */
if (CONFIG_BOOLEAN(config_look_set_title))
gui_window_title_reset ();
/* end color */
gui_color_end ();
}
/* end of Curses output */
refresh ();
+35 -30
View File
@@ -205,40 +205,45 @@ gui_main_loop ()
/*
* gui_main_end: GUI end
* clean_exit is 0 when WeeChat is crashing (we don't clean
* objects because WeeChat can crash again during this cleanup...)
*/
void
gui_main_end ()
gui_main_end (int clean_exit)
{
struct t_gui_window *ptr_win;
/* free clipboard buffer */
if (gui_input_clipboard)
free(gui_input_clipboard);
/* delete all windows */
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
/* TODO: destroy Gtk widgets */
}
/* delete all buffers */
while (gui_buffers)
gui_buffer_close (gui_buffers, 0);
/* delete all windows */
while (gui_windows)
gui_window_free (gui_windows);
gui_window_tree_free (&gui_windows_tree);
/* delete global history */
gui_history_global_free ();
/* delete infobar messages */
while (gui_infobar)
gui_infobar_remove ();
/* reset title */
if (CONFIG_BOOLEAN(config_look_set_title))
gui_window_title_reset ();
if (clean_exit)
{
/* free clipboard buffer */
if (gui_input_clipboard)
free(gui_input_clipboard);
/* delete all windows */
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
/* TODO: destroy Gtk widgets */
}
/* delete all buffers */
while (gui_buffers)
gui_buffer_close (gui_buffers, 0);
/* delete all windows */
while (gui_windows)
gui_window_free (gui_windows);
gui_window_tree_free (&gui_windows_tree);
/* delete global history */
gui_history_global_free ();
/* delete infobar messages */
while (gui_infobar)
gui_infobar_remove ();
/* reset title */
if (CONFIG_BOOLEAN(config_look_set_title))
gui_window_title_reset ();
}
}
+1 -1
View File
@@ -25,6 +25,6 @@
extern void gui_main_loop ();
extern void gui_main_pre_init (int *argc, char **argv[]);
extern void gui_main_init ();
extern void gui_main_end ();
extern void gui_main_end (int clean_exit);
#endif /* gui-main.h */