GNOME Bugzilla – Bug 382565
GtkTextView invisible text crash
Last modified: 2007-02-20 09:02:15 UTC
Steps to reproduce: 1. make simple app : #include <gtk/gtk.h> int main(int argc,char *argv[]) { GtkWidget *wnd; GtkWidget *view; GtkTextBuffer *buff; GtkTextIter stiter; gtk_init(&argc,&argv); view = gtk_text_view_new (); buff = gtk_text_view_get_buffer ( GTK_TEXT_VIEW ( view ) ); gtk_text_buffer_get_start_iter( buff, &stiter ); gtk_text_buffer_create_tag ( buff, "Embed", "invisible", TRUE, NULL ); gtk_text_buffer_insert ( buff, &stiter, "Normal text ", -1 ); gtk_text_buffer_insert_with_tags_by_name( buff, &stiter, ":)", 2, "Embed", NULL ); gtk_text_buffer_insert ( buff, &stiter, " Normal text", -1 ); wnd = gtk_window_new ( GTK_WINDOW_TOPLEVEL ); gtk_container_add ( GTK_CONTAINER (wnd), view); gtk_widget_show_all( wnd ); gtk_main(); return 0; } 2. compile it and run 3. go too next line by pressing return key at the end of line. Type some text and press return, than type some more text and press return. For example : Normal text Normal text[Enter] aaaaaaaaaaaaaaaaaaaaaaa[Enter] bbbbbbbbbbbbbbbbbbbbbbb[Enter] 4. Then press left arrow key to move to the begin of text For example abov move from empty line to line with Normal text using left arrow 5. But app will crash when you move from first character of second line to last character of first line. Stack trace: Program output (tst:11379): Gtk-WARNING **: gtktextbtree.c:3974: byte index off the end of the line Gtk-ERROR **: Byte index 29 is off the end of the line aborting... Aborted Other information: This bug come only when you use invisible text in GtkTextView. App was tested at gtk+ 2.8 and 2.10 .
Could you paste a backtrace from gdb here please?
+ Trace 110926
I'm used SUSE 10.1
Looks like gtk_text_layout_move_iter_visually is busted when moving between paragraphs containing invisible text, since use byte counts without taking visibility into account.
2007-02-18 Matthias Clasen <mclasen@redhat.com> * gtk/gtktextlayout.c (gtk_text_layout_move_iter_visually): Ignore invisible text when going to end of the previous line. (#382565)
*** Bug 363602 has been marked as a duplicate of this bug. ***