GtkText widget crashing application



Hello all,

	I'm am currently writing an application which monitors and displays
changes to a file.  This file can get quite large and so I am attempting to
limit how much of it my application displays to some value (say 128K).  Before I
did this the application would bog down to a crawl after the gtktext widget
became too large.  However, with the simple code below inserted, I get the
following error message;

Gtk-ERROR **: file gtktext.c: line 4712 (find_line_params): assertion failed:
(lp.end.property)
aborting...
Abort

I am somewhat suspicous of GtkText, as this code works fine on Solaris 2.6, but
only for small blocks of character deletions/insertions or large blocks of
characters over a small number of iterations on SunOS 4.1.4.  Does anybody have
any idea(s) as to what may be going on?  I am currently running glib-1.2.8 and
gtk+-1.2.8 compiled using gnu make 3.79 and gcc-2.95 for SunOS 4.1.4 and Solaris
2.6.  I have seen comments within the mailing lists by Owen Taylor concerning
this issue dating back to 1998 indicating that patches were to be applied to
either 1.0.5 or 1.1.0 to fixed this problem.  Any and all responses would be
appreciated.  Note: this problem also existed when using glib-1.2.7 and
gtk+-1.2.7.



				-- Stupid Genius


/* Declaring local variables */
guint gtktext_memory_limit;
guint gtktext_current_memory_usage;
guint delete_length;



/* limiting gtktext widget to 128K bytes memory */
gtktext_memory_limit = pow(2,17);
gtktext_current_memory_usage = gtk_text_get_length(GTK_TEXT(text));

if ( gtktext_current_memory_usage > gtktext_memory_limit )
{
	delete_length = gtktext_current_memory_usage - gtktext_memory_limit;
	while ( GTK_TEXT_INDEX(GTK_TEXT(text), delete_length++) != '\n' );
	gtk_text_set_point(GTK_TEXT(text), (guint) 0);
	gtk_text_forward_delete(GTK_TEXT(text), --delete_length);
	gtk_text_set_point(GTK_TEXT(text), gtk_text_get_length(GTK_TEXT(text)));
}






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]