GtkText Widget SEGFAULTS

I am experiencing segfaults in file gtktext.c in function decrement_mark_n()
when called in the following sequnce;


The segfaulting line is:
	mark->offset = MARK_CURRENT_PROPERTY (mark)->length - 1;
where mark.>offset has a value of 37910 and local variable "n" has a value of

Here is the code snippet calling gtk_text_forward_delete;

/* 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);
	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)));

delete_length = 51841 at the time of the segfault.  However, since it is
declared as a guint, and an int on Solaris = 4 bytes, this variable can hold a
value of up to 4,294,967,296!  And I know that text points to the proper text
widget since this only occurs after several other messages have been posted to
the proper widget using the same pointer.  All calls after this are being made
to and from gtktext.c functions, so 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

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.

				-- Stupid Genius

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