|
hello gtk-gurus,
I have a strange problem using the GtkTextBuffer widget. I want to display some text which is provided by two threads in a GtkTextView. The new text simply should be appended to the existing one so that I get a kind of logfile.
Therefore I have created a function called "logging (char* txt_p)" which is called in every thread. This function creates a new text buffer GtkTextBuffer, fetches the current text of the GtkTextView widget, sets an iterator at the end of the text and inserts the new string. Finally, the text buffer is written onto the GtkTextView widget. To make the function thread-safe I use pthread_mutex_t.
Now I have the problem, that the application crashes with the following error:
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
Can anyone help me pleaze??
mike
|