[gnome-chess/gnome-3-8] Workaround signal misfires that led to crash



commit ec4e7905b79a56ce141a1d9c3c021a321356a86f
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Sun Jun 22 20:20:10 2014 -0500

    Workaround signal misfires that led to crash
    
    Even though the original ChessGame is always destroyed immediately after
    the creation of a new one (no other reference to it exists), the signals
    we connected to the original game may be nonetheless fired by the NEW
    game object. This must be a bug in Vala signals.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=732067

 src/gnome-chess.vala |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/src/gnome-chess.vala b/src/gnome-chess.vala
index c607a23..e2174b2 100644
--- a/src/gnome-chess.vala
+++ b/src/gnome-chess.vala
@@ -398,6 +398,17 @@ public class Application : Gtk.Application
             else
                 warning ("Chess game has SetUp tag but no FEN tag");
         }
+
+        /* Workaround for https://bugzilla.gnome.org/show_bug.cgi?id=732067 */
+        if (game != null)
+        {
+            game.started.disconnect (game_start_cb);
+            game.turn_started.disconnect (game_turn_cb);
+            game.moved.disconnect (game_move_cb);
+            game.undo.disconnect (game_undo_cb);
+            game.ended.disconnect (game_end_cb);
+        }
+
         game = new ChessGame (fen, moves);
 
         /*


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