changeset 1142:0e27177882c7

Small fix for the max_history_blocks option
author Mikael Berthe <mikael@lilotux.net>
date Tue, 06 Feb 2007 07:37:20 +0100
parents 5be2408a6534
children d48822e6586b
files mcabber/src/screen.c
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mcabber/src/screen.c	Tue Feb 06 00:21:42 2007 +0100
+++ b/mcabber/src/screen.c	Tue Feb 06 07:37:20 2007 +0100
@@ -660,6 +660,7 @@
   char *text_locale;
   int dont_show = FALSE;
   int special;
+  guint num_history_blocks;
   bool setmsgflg = FALSE;
 
   // Look for the window entry.
@@ -689,10 +690,16 @@
   if (win_entry->cleared)
     win_entry->top = g_list_last(win_entry->hbuf);
 
+  // Make sure we do not free the buffer while it's locked or when
+  // top is set.
+  if (win_entry->lock || win_entry->top)
+    num_history_blocks = 0U;
+  else
+    num_history_blocks = get_max_history_blocks();
+
   text_locale = from_utf8(text);
   hbuf_add_line(&win_entry->hbuf, text_locale, timestamp, prefix_flags,
-                maxX - Roster_Width - PREFIX_WIDTH,
-                get_max_history_blocks());
+                maxX - Roster_Width - PREFIX_WIDTH, num_history_blocks);
   g_free(text_locale);
 
   if (win_entry->cleared) {