diff options
Diffstat (limited to 'src/gui/gui-common.c')
-rw-r--r-- | src/gui/gui-common.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/gui/gui-common.c b/src/gui/gui-common.c index f64d79bea..633d4acf1 100644 --- a/src/gui/gui-common.c +++ b/src/gui/gui-common.c @@ -337,7 +337,7 @@ gui_infobar_printf (int time_displayed, int color, char *message, ...) void gui_window_free (t_gui_window *window) { - if (window->buffer->num_displayed > 0) + if (window->buffer && (window->buffer->num_displayed > 0)) window->buffer->num_displayed--; /* remove window from windows list */ @@ -458,6 +458,12 @@ gui_buffer_free (t_gui_buffer *buffer, int switch_to_another) if (last_gui_buffer == buffer) last_gui_buffer = buffer->prev_buffer; + for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window) + { + if (ptr_win->buffer == buffer) + ptr_win->buffer = NULL; + } + free (buffer); /* always at least one buffer */ |