[gnome-chess/gnome-3-8] Always undo from most the most recent move
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-chess/gnome-3-8] Always undo from most the most recent move
- Date: Wed, 5 Jun 2013 17:37:19 +0000 (UTC)
commit c8fbcee2975cf2e607e069526aa8aa113fd4487d
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
(cherry picked from commit 32d04f0be44ea8cba396500c3f97de0fe39b675c)
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 be33fe7..d6e8e22 100644
--- a/src/gnome-chess.vala
+++ b/src/gnome-chess.vala
@@ -822,13 +822,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]