[gnome-chess] Always undo from most the most recent move



commit 32d04f0be44ea8cba396500c3f97de0fe39b675c
Author: Chris Cummins <christopher e cummins intel com>
Date:   Tue Jun 4 16:58:39 2013 +0100

    Always undo from most the most recent move
    
    This makes the in-game undo action always undo the most recent
    move. This prevents a Segmentation Fault when the user selects "Show
    previous move" and then attempts to undo move.
    
    v2: don't loop on assignment (review from Michael Catanzaro).
    
    https://bugzilla.gnome.org/show_bug.cgi?id=701601

 src/gnome-chess.vala |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/src/gnome-chess.vala b/src/gnome-chess.vala
index 9db0db7..8d805b2 100644
--- a/src/gnome-chess.vala
+++ b/src/gnome-chess.vala
@@ -821,13 +821,13 @@ public class Application : Gtk.Application
         model.iter_nth_child (out iter, null, model.iter_n_children (null) - 1);
         model.remove (iter);
 
-        /* If watching this move, go back one */
-        if (scene.move_number > game.n_moves || scene.move_number == -1)
-        {
-            model.iter_nth_child (out iter, null, model.iter_n_children (null) - 1);
-            history_combo.set_active_iter (iter);
-            view.queue_draw ();
-        }
+        /* Always undo from the most recent move */
+        scene.move_number = -1;
+
+        /* Go back one */
+        model.iter_nth_child (out iter, null, model.iter_n_children (null) - 1);
+        history_combo.set_active_iter (iter);
+        view.queue_draw ();
 
         if (game.n_moves > 0)
         {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]