Delete a gtktextbuffer to fill it again



Hi,

I use gtk_text_buffer_delete this way:

if (textbuf != NULL)
{
        gtk_text_buffer_get_start_iter (textbuf,&start);
        gtk_text_buffer_get_end_iter (textbuf,&end);
        gtk_text_buffer_delete (textbuf,&start,&end);
}

However the very second time I try to fill the gtktextbuffer with some
text, it's cleaned but not filled and I get a bunch of these messages in the console window:

(xarchiver:4473): Gtk-CRITICAL **: gtk_text_buffer_insert: assertion `gtk_text_iter_get_buffer (iter) == buffer' failed

(xarchiver:4473): Gtk-WARNING **: Invalid text buffer iterator: either the iterator is uninitialized, or the characters/pixbufs/widgets in the buffer have been modified since the iterator was created. You must use marks, character numbers, or line numbers to preserve a position across buffer modifications.
You can apply tags and insert marks without invalidating your iterators,
but any mutation that affects 'indexable' buffer contents (contents that can be referred to by character offset)
will invalidate all outstanding iterators

I fill the text gtk_text_buffer this way:
if (line != NULL) gtk_text_buffer_insert(textbuf, &enditer, line, strlen( line ) );

Where am I wrong ??
--
Colossus

Cpsed, a Linux OpenGL 3D scene editor
http://cpsed.sourceforge.net/




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