[gnome-calculator] Fix invalid GtkTextIter after inserting thousands separator
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calculator] Fix invalid GtkTextIter after inserting thousands separator
- Date: Thu, 23 Oct 2014 03:50:22 +0000 (UTC)
commit 0d838a7ff892b04fa82874b390198b64b5fe4c0b
Author: Michael Catanzaro <mcatanzaro gnome org>
Date: Wed Oct 22 22:43:40 2014 -0500
Fix invalid GtkTextIter after inserting thousands separator
Ensure the iterator points to the position immediately after the
inserted text when insert_text() returns by using a mark with right
gravity.
Note that this may have been associated with the following crasher:
https://bugzilla.gnome.org/show_bug.cgi?id=737291
src/math-equation.vala | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/src/math-equation.vala b/src/math-equation.vala
index d9441e3..7169970 100644
--- a/src/math-equation.vala
+++ b/src/math-equation.vala
@@ -1179,6 +1179,8 @@ public class MathEquation : Gtk.SourceBuffer
return;
}
+ var mark = create_mark (null, location, false);
+
/* If following a delete then have already pushed undo stack (Gtk.TextBuffer doesn't indicate
replace operations so we have to infer them) */
if (!in_delete)
push_undo_stack ();
@@ -1209,8 +1211,11 @@ public class MathEquation : Gtk.SourceBuffer
state.entered_multiply = text == "×";
- /* Update thousands separators */
+ /* Update thousands separators, then revalidate iterator */
reformat_separators ();
+ get_iter_at_mark (out location, mark);
+
+ delete_mark (mark);
notify_property ("display");
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]