[gnome-calculator/gnome-3-14: 16/19] Fix invalid GtkTextIter after inserting thousands separator



commit d10e04b48c8bcf2a3e6ed616382e0f01a62590f4
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]