[gnome-chess] window: don't try to disconnect from the clock's tick callback



commit ea3446bef22b5ccf3d39423940f1d216b5f78125
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Thu Apr 8 14:33:29 2021 -0500

    window: don't try to disconnect from the clock's tick callback
    
    This doesn't work because at the time we try to disconnect, game is a
    different game than it was before, with a different clock. Oops.
    
    There's no need to disconnect because the clock will always be destroyed
    by the time we start a new game. In the unlikely event that ever changes
    in the future, the worst that can happen is redrawing the clock labels
    more often than necessary. So it should be safe to just never
    disconnect.

 src/chess-window.vala | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)
---
diff --git a/src/chess-window.vala b/src/chess-window.vala
index 4c1a722..208d721 100644
--- a/src/chess-window.vala
+++ b/src/chess-window.vala
@@ -54,8 +54,6 @@ public class ChessWindow : Gtk.ApplicationWindow
 
     private ChessApplication app;
 
-    private ulong clock_tick_signal_id = 0;
-
     [GtkChild]
     private unowned Gtk.Box main_box;
     [GtkChild]
@@ -524,15 +522,9 @@ public class ChessWindow : Gtk.ApplicationWindow
         white_time_label.queue_draw ();
         black_time_label.queue_draw ();
 
-        if (clock_tick_signal_id != 0)
-        {
-            disconnect (clock_tick_signal_id);
-            clock_tick_signal_id = 0;
-        }
-
         if (game.clock != null)
         {
-            clock_tick_signal_id = game.clock.tick.connect (() => {
+            game.clock.tick.connect (() => {
                 white_time_label.queue_draw ();
                 black_time_label.queue_draw ();
             });


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