[gnome-chess] Stop the chess clock when ChessGame is freed



commit 7862319a7e4999f9b0bd9991d1480a8c2247ae91
Author: Michael Catanzaro <mike catanzaro gmail com>
Date:   Thu Jun 6 17:22:00 2013 -0500

    Stop the chess clock when ChessGame is freed
    
    Otherwise, the timer event remains in the main loop, and causes us to
    crash when it expires. This would happen if the game is not stopped
    before starting a new one, e.g. when the player uses "New Game" or "Load
    Game" before the previous game has played to completion.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=701705

 src/chess-game.vala |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/src/chess-game.vala b/src/chess-game.vala
index e535b26..56a7eef 100644
--- a/src/chess-game.vala
+++ b/src/chess-game.vala
@@ -1315,6 +1315,12 @@ public class ChessGame
         black.do_claim_draw.connect (claim_draw_cb);
     }
 
+    ~ChessGame ()
+    {
+        if (_clock != null)
+            _clock.stop ();
+    }
+
     private bool move_cb (ChessPlayer player, string move, bool apply)
     {
         if (!is_started)


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