[gnome-chess/gnome-3-10] chess_game_remove_hold: assertion '_tmp0_ > 0' failed
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-chess/gnome-3-10] chess_game_remove_hold: assertion '_tmp0_ > 0' failed
- Date: Sat, 2 Nov 2013 20:09:47 +0000 (UTC)
commit 8a0ef21a4ed9ff0a8c0180f2fba7e0e1dcfb7fee
Author: Michael Catanzaro <mcatanzaro gnome org>
Date: Sat Nov 2 15:06:59 2013 -0500
chess_game_remove_hold: assertion '_tmp0_ > 0' failed
This occurred when starting a new game. We would call remove_hold on the
new ChessGame object as a consequence of "finishing" the animation for
the previous game. But no hold had ever been placed on the new object.
src/chess-scene.vala | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/src/chess-scene.vala b/src/chess-scene.vala
index 5b635e6..882b009 100644
--- a/src/chess-scene.vala
+++ b/src/chess-scene.vala
@@ -82,12 +82,20 @@ public class ChessScene : Object
public int selected_rank = -1;
public int selected_file = -1;
+ private uint animate_timeout_id = 0;
+
private ChessGame? _game = null;
public ChessGame? game
{
get { return _game; }
set
{
+ if (animate_timeout_id != 0)
+ {
+ Source.remove (animate_timeout_id);
+ animate_timeout_id = 0;
+ animating = false;
+ }
_game = value;
_move_number = -1;
selected_rank = -1;
@@ -325,7 +333,7 @@ public class ChessScene : Object
game.add_hold ();
/* Animate every 10ms (up to 100fps) */
- Timeout.add (10, animate_cb, Priority.DEFAULT_IDLE);
+ animate_timeout_id = Timeout.add (10, animate_cb, Priority.DEFAULT_IDLE);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]