From 5c29def9d961ae45eaf2732ead01ee155a4a2596 Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Sun, 26 Feb 2006 11:27:43 +0000 Subject: Fixed crash when using global history (when older entry is removed) --- ChangeLog | 3 ++- src/common/history.c | 4 ++++ weechat/ChangeLog | 3 ++- weechat/src/common/history.c | 4 ++++ 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 03d41570a..10f1cac09 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,10 +1,11 @@ WeeChat - Wee Enhanced Environment for Chat =========================================== -ChangeLog - 2006-02-22 +ChangeLog - 2006-02-26 Version 0.1.8 (under dev!): + * fixed crash when using global history (when older entry is removed) * added IRC raw data buffer (new key: alt-J + alt-R) * fixed display bug with /kill command * added new plugins functions: add_timer_handler, remove_timer_handler, diff --git a/src/common/history.c b/src/common/history.c index f7aeae403..db61276f7 100644 --- a/src/common/history.c +++ b/src/common/history.c @@ -99,6 +99,8 @@ history_buffer_add (void *buffer, char *string) && (((t_gui_buffer *)(buffer))->num_history > cfg_history_max_commands)) { ptr_history = ((t_gui_buffer *)buffer)->last_history->prev_history; + if (((t_gui_buffer *)buffer)->ptr_history == ((t_gui_buffer *)buffer)->last_history) + ((t_gui_buffer *)buffer)->ptr_history = ptr_history; ((t_gui_buffer *)buffer)->last_history->prev_history->next_history = NULL; if (((t_gui_buffer *)buffer)->last_history->text) free (((t_gui_buffer *)buffer)->last_history->text); @@ -144,6 +146,8 @@ history_global_add (char *string) && (num_history_global > cfg_history_max_commands)) { ptr_history = history_global_last->prev_history; + if (history_global_ptr == history_global_last) + history_global_ptr = ptr_history; history_global_last->prev_history->next_history = NULL; if (history_global_last->text) free (history_global_last->text); diff --git a/weechat/ChangeLog b/weechat/ChangeLog index 03d41570a..10f1cac09 100644 --- a/weechat/ChangeLog +++ b/weechat/ChangeLog @@ -1,10 +1,11 @@ WeeChat - Wee Enhanced Environment for Chat =========================================== -ChangeLog - 2006-02-22 +ChangeLog - 2006-02-26 Version 0.1.8 (under dev!): + * fixed crash when using global history (when older entry is removed) * added IRC raw data buffer (new key: alt-J + alt-R) * fixed display bug with /kill command * added new plugins functions: add_timer_handler, remove_timer_handler, diff --git a/weechat/src/common/history.c b/weechat/src/common/history.c index f7aeae403..db61276f7 100644 --- a/weechat/src/common/history.c +++ b/weechat/src/common/history.c @@ -99,6 +99,8 @@ history_buffer_add (void *buffer, char *string) && (((t_gui_buffer *)(buffer))->num_history > cfg_history_max_commands)) { ptr_history = ((t_gui_buffer *)buffer)->last_history->prev_history; + if (((t_gui_buffer *)buffer)->ptr_history == ((t_gui_buffer *)buffer)->last_history) + ((t_gui_buffer *)buffer)->ptr_history = ptr_history; ((t_gui_buffer *)buffer)->last_history->prev_history->next_history = NULL; if (((t_gui_buffer *)buffer)->last_history->text) free (((t_gui_buffer *)buffer)->last_history->text); @@ -144,6 +146,8 @@ history_global_add (char *string) && (num_history_global > cfg_history_max_commands)) { ptr_history = history_global_last->prev_history; + if (history_global_ptr == history_global_last) + history_global_ptr = ptr_history; history_global_last->prev_history->next_history = NULL; if (history_global_last->text) free (history_global_last->text); -- cgit v1.2.3