gtk_text_buffer_insert



hi everyone, does anyone know how to solve this?

main()
{
  GtkWidget *text;
  GtkTextBuffer *buffer;
  GtkTextIter iter;
  GtkTextIter start, end;
.
.
.
  function1(text, buffer, iter);
  function2(text, buffer, iter);
}

void
function1 (GtkWidget *text,
           GtkTextBuffer *buffer,
           GtkTextIter iter)
{
  gtk_text_buffer_insert (buffer, &iter, "printing
from function1\n\n", -1);
}

void
function2 (GtkWidget *text,
           GtkTextBuffer *buffer,
           GtkTextIter iter)
{
  gtk_text_buffer_insert (buffer, &iter, "printing
from function2\n\n", -1);
}
  
in the above program, only function1 prints, but not
function2, and instead i got the following error:

(a:3445): 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
 
(a:3445): Gtk-CRITICAL **: file gtktextbuffer.c: line
577 (gtk_text_buffer_insert): assertion
`gtk_text_iter_get_buffer (iter) == buffer' failed

can anyone help?


                
__________________________________ 
Do you Yahoo!? 
Meet the all-new My Yahoo! - Try it today! 
http://my.yahoo.com 
 




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