gtk_text weird behaviour




After a lot of debugging and coding I think I found a bug in the gtk_text
widget. To demonstrate this I've added some code to the text.c example
from the tutorial. I'm not sure about the policies of this list so I've
put the source on a ftp server (4kb):
ftp://137.224.211.16/pub/gtk_text/texttest.tar.gz

The code includes 2 files, a html file and a simple Makefile. text.c is
the file from the tutorial with 3 buttons added. highlight.c contains code
to add syntax highlighting using regular expressions. 

What basically happens is that it search the text for a pattern. If a
match is found it deletes the match and inserts it again using colored
text. If you remove the "#define CRAPPY_FIX" it will crash during one of
those gtk_text_insert() calls. gdb backtrace tells me the segfault is in
gtk_text_forward_delete(). The gtk version is 1.2.6.

The crappy fix calls gtk_text_thaw() and gtk_text_freeze() once for every
set_point/delete/insert call. This slows down the GUI, but the code is
stable.

The segfault only happens if the scollbar position is > 0 or the cursor
position is > 0. Play around to see the problem. In the .tar.gz the
CRAPPY_FIX is defined, so that version is stable-but-slow.

if this is allowed I could send the code as attachment, please let me
know.

another thing I noticed is I can't set the curor position in a
frozen gtk_text widget. This segfaults as well. But that is probably a
different thing.

lots of thanks if somebody can fix this problem.

bye,
	Olivier Sessink

--
Hi, I'm a signature virus. plz set me as your signature and help me
spread:)



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