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

Re: gtk text weird behaviour



On Thu, Feb 10, 2000 at 09:11:50AM +0100, olivier@lx.student.wau.nl wrote:
...
> this is the current situation:
> 
> freeze
> loop start
> 	do something in widget
> 	thaw
> 	set point
> 	freeze
> 	do more in widget
> end loop
> thaw
> 
> if I don't have the thaw/freeze around the set_point in the loop it
> segfaults.

It shouldn't.  There might be something done elsewhere in your code
which is affecting it.


> The other problem is here, I want to remove all coloring by doing this:

So there are two problems here?  Are they related?  Can you provide
more details on what you're doing and what's happening?


> gtk_text_freeze(GTK_TEXT(whichdoc->textbox));
> buffer = gtk_editable_get_chars(GTK_EDITABLE(whichdoc->textbox), 0, -1);
> gtk_editable_delete_text(GTK_EDITABLE(whichdoc->textbox), 0, -1);
> gtk_editable_insert_text(GTK_EDITABLE(whichdoc->textbox), buffer,strlen(buffer), 0);
> gtk_text_thaw(GTK_TEXT(whichdoc->textbox));
> g_free(buffer);
> 
> this looks to me very standard gtk code, but it segfaults on the
> gtk_editable_insert_text()
> 
> what's wrong?

Without knowing how your two problems are related, if at all, it's
hard to say.  One guess is that you should probably be using
gtk_text_forward_delete() and gtk_text_insert() instead of
gtk_editable_delete_text() and gtk_editable_insert_text() since
deletion and insertion of text in a text widget needs to properly
update the point/position in the editable.

Also, if you know how, it would be useful to use a debugger to see
why/what gtk_editable_insert_text() is faulting.

regards,
--andy



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