Hi all I am trying to search a text view and I think I understand the theory but I can't seem to get my code working in practice. What I have come to understand is that I create a textmark object and try to search for the presence of the text mark in the buffer, if it's found then create an iter at the position of the text mark. From there search the document for the presence of the search string, if it is found and the text mark can't be found in the document create the text mark and highlight the search string.
My program seg faults with the following error: (X2:32030): 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 If someone could help me I would be very appreciative. Neil Munro static void Search( GtkWidget *widget, struct node *tmp ) { gchar *search; search = gtk_entry_get_text( GTK_ENTRY( tmp->Search1 ) ); gboolean found; GtkTextMark *last_pos; GtkTextIter start, end; last_pos = gtk_text_buffer_get_mark( GTK_TEXT_BUFFER( tmp->Buffer ), "last_pos" ); if( last_pos ) gtk_text_buffer_get_iter_at_mark( GTK_TEXT_BUFFER( tmp->Buffer ), &tmp->iter, last_pos ); found = gtk_text_iter_forward_search( &tmp->iter, search, 0, &start, &end, NULL ); if( found ) { if( last_pos == NULL ) gtk_text_buffer_create_mark( GTK_TEXT_BUFFER( tmp->Buffer ), "last_pos", &end, FALSE ); gtk_text_buffer_select_range( GTK_TEXT_BUFFER( tmp->Buffer ), &tmp->iter, &end ); } } _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list