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



commit c495957175bdc29597e2ca51e1e2b0e01f02bad5
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
    (cherry picked from commit 7862319a7e4999f9b0bd9991d1480a8c2247ae91)

 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 47825f0..7f73794 100644
--- a/src/chess-game.vala
+++ b/src/chess-game.vala
@@ -1297,6 +1297,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]