Mercurial > pidgin
comparison plugins/spellchk.c @ 11319:d9debf609b79
[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 <tailor@pidgin.im>
author | Stu Tomlinson <stu@nosnilmot.com> |
---|---|
date | Sat, 20 Aug 2005 21:11:57 +0000 |
parents | 519dc2186438 |
children | 45a0c48c33a6 |
comparison
equal
deleted
inserted
replaced
11318:519dc2186438 | 11319:d9debf609b79 |
---|---|
459 | 459 |
460 static void | 460 static void |
461 insert_text_after(GtkTextBuffer *buffer, GtkTextIter *iter, | 461 insert_text_after(GtkTextBuffer *buffer, GtkTextIter *iter, |
462 gchar *text, gint len, spellchk *spell) | 462 gchar *text, gint len, spellchk *spell) |
463 { | 463 { |
464 GtkTextIter start; | 464 GtkTextIter start, end; |
465 GtkTextMark *mark; | |
465 | 466 |
466 if (spell->ignore_correction) { | 467 if (spell->ignore_correction) { |
467 spell->ignore_correction = FALSE; | 468 spell->ignore_correction = FALSE; |
468 return; | 469 return; |
469 } | 470 } |
472 gtk_text_buffer_get_iter_at_mark(buffer, &start, spell->mark_insert_start); | 473 gtk_text_buffer_get_iter_at_mark(buffer, &start, spell->mark_insert_start); |
473 | 474 |
474 if (len == 1) | 475 if (len == 1) |
475 check_range(spell, buffer, start, *iter); | 476 check_range(spell, buffer, start, *iter); |
476 | 477 |
477 gtk_text_buffer_move_mark(buffer, spell->mark_insert_end, iter); | 478 /* if check_range modified the buffer, iter has been invalidated */ |
479 mark = gtk_text_buffer_get_insert(buffer); | |
480 gtk_text_buffer_get_iter_at_mark(buffer, &end, mark); | |
481 gtk_text_buffer_move_mark(buffer, spell->mark_insert_end, &end); | |
478 | 482 |
479 spell->inserting = FALSE; | 483 spell->inserting = FALSE; |
480 | 484 |
481 } | 485 } |
482 | 486 |