[gnome-chess] scene: properly disconnect game signals
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-chess] scene: properly disconnect game signals
- Date: Fri, 25 Dec 2020 17:14:13 +0000 (UTC)
commit 400a556af531b3e2606ecd87fe8505603c010e62
Author: Michael Catanzaro <mcatanzaro gnome org>
Date: Fri Dec 25 10:06:49 2020 -0600
scene: properly disconnect game signals
src/chess-scene.vala | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
---
diff --git a/src/chess-scene.vala b/src/chess-scene.vala
index 021384c..fde2a26 100644
--- a/src/chess-scene.vala
+++ b/src/chess-scene.vala
@@ -100,14 +100,26 @@ public class ChessScene : Object
animate_timeout_id = 0;
animating = false;
}
+
+ if (_game != null)
+ {
+ _game.moved.disconnect (moved_cb);
+ _game.paused.disconnect (paused_cb);
+ _game.unpaused.disconnect (unpaused_cb);
+ _game.undo.disconnect (undo_cb);
+ }
+
_game = value;
- _move_number = -1;
- selected_rank = -1;
- selected_file = -1;
+
_game.moved.connect (moved_cb);
_game.paused.connect (paused_cb);
_game.unpaused.connect (unpaused_cb);
_game.undo.connect (undo_cb);
+
+ _move_number = -1;
+ selected_rank = -1;
+ selected_file = -1;
+
update_board ();
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]