# HG changeset patch # User Stu Tomlinson # Date 1124572317 0 # Node ID d9debf609b79932a33f2573e4532dd103ea1c81a # Parent 519dc2186438356970477cd49014a685e5408a0c [gaim-migrate @ 13522] I'm quite amazed this worked at all. Did no-one notice debug output like this: Gtk: 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 Gtk: gtk_text_buffer_set_mark: assertion `gtk_text_iter_get_buffer (iter) == buffer' failed committer: Tailor Script diff -r 519dc2186438 -r d9debf609b79 plugins/spellchk.c --- a/plugins/spellchk.c Sat Aug 20 20:17:08 2005 +0000 +++ b/plugins/spellchk.c Sat Aug 20 21:11:57 2005 +0000 @@ -461,7 +461,8 @@ insert_text_after(GtkTextBuffer *buffer, GtkTextIter *iter, gchar *text, gint len, spellchk *spell) { - GtkTextIter start; + GtkTextIter start, end; + GtkTextMark *mark; if (spell->ignore_correction) { spell->ignore_correction = FALSE; @@ -474,7 +475,10 @@ if (len == 1) check_range(spell, buffer, start, *iter); - gtk_text_buffer_move_mark(buffer, spell->mark_insert_end, iter); + /* if check_range modified the buffer, iter has been invalidated */ + mark = gtk_text_buffer_get_insert(buffer); + gtk_text_buffer_get_iter_at_mark(buffer, &end, mark); + gtk_text_buffer_move_mark(buffer, spell->mark_insert_end, &end); spell->inserting = FALSE;