[gnome-klotski] Disconnect puzzle.



commit a81d5a550bb73ac757e29bcdc257312f954f58d4
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Sat Feb 8 19:22:33 2020 +0100

    Disconnect puzzle.

 src/klotski-window.vala | 4 ++++
 1 file changed, 4 insertions(+)
---
diff --git a/src/klotski-window.vala b/src/klotski-window.vala
index 76d0a90..035692d 100644
--- a/src/klotski-window.vala
+++ b/src/klotski-window.vala
@@ -60,6 +60,7 @@ private class KlotskiWindow : ApplicationWindow
     private SimpleAction start_game;
 
     /* The game being played */
+    private bool puzzle_init_done = false;
     private Puzzle puzzle;
 
     private int current_pack = -1;
@@ -772,7 +773,10 @@ private class KlotskiWindow : ApplicationWindow
     private void start_puzzle ()
     {
         headerbar.set_title (_(levels[current_level].name));
+        if (puzzle_init_done)
+            SignalHandler.disconnect_by_func (puzzle, null, this);
         puzzle = new Puzzle (levels[current_level].width, levels[current_level].height, 
levels[current_level].data);
+        puzzle_init_done = true;
         puzzle.moved.connect (puzzle_moved_cb);     // TODO disconnect previous puzzle?
         view.puzzle = puzzle;
 


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