RE: GtkText Widget SEGFAULTS


First, thank you for your response.  I appreciate it!  I'm not sure if what I am
doing so too complex, but I suspect it is somewhat demanding.  Conceptually, I
am reading a file and displaying it's contents using either a normal or boldface
fix width font in the text widget.  Pretty simple.  However, I am also trying to
limit the size of the gtktext widget using the code snippet below.  The
demanding part comes from trying to append about 64K of text to the widget via
multiple calls to gtk_text_insert(), setting the cursor to the begining of the
widget, removing via a single call to gtk_text_forward_delete() 64K of text, and
then resetting the cursor to the end of the widget - all while the widget is
frozen.  This process may run for hundreds to tens of thousand of iterations.
If this is too demanding and/or complex for the gtktext widget, is the new
gtktext widget capable handling this and is it compatable with version 1.2.8?
(i.e. can I swap out the old gtktext widget files with the new gtktext widget
files?)  I don't want to appear to be snubbing GtkExText, but would prefer to
work with what's eventually going to be released if possible.  Thanks in

				-- Stupid Genius

/* 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);
	if ( gtk_text_forward_delete(GTK_TEXT(text), delete_length) == FALSE )
		printf("ERROR: gtk_text_forward_delete failed!"\n);
	gtk_text_set_point(GTK_TEXT(text), gtk_text_get_length(GTK_TEXT(text)));

Where the variables used are declared as follows;
/* Declaring local variables */
guint gtktext_memory_limit;
guint gtktext_current_memory_usage;
guint delete_length;

> ----------
> From: 	Havoc Pennington[]
> Sent: 	Sunday, August 13, 2000 7:17 PM
> To: 	Dugas, Alan
> Cc:;
> Subject: 	Re: GtkText Widget SEGFAULTS
> "Dugas, Alan" <> writes:
> > I am somewhat suspicous now of a bug in
> > gtktext.c.  Does anyone know of a problem with GtkText that might cause
> this?
> > (i.e. racing conditions, wild pointers, memory leaks, etc ?)  Has anyone
> else
> > run into a simular problem using gtktext?  Any and all help would be greatly
> > appreciated!
> > 
> > I am running gtk+-1.2.8, glib-1.2.8, and X11R6.4, compiled on Solaris-2.6
> using
> > gcc-2.95.2 and gmake-3.79.
> > 
> Sadly, GtkText is known to be a bit buggy. However the code is more or
> less unfixable (without a complete rewrite). So there is a new text
> widget in the next version of GTK+.
> There's a GtkExText available on the net that's pretty much the same
> API as GtkText, only less broken. If you're doing something with
> GtkText beyond simply sticking it in a window and getting/setting its
> contents, using GtkExText is not a bad idea.
> Havoc
> _______________________________________________
> gtk-list mailing list

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