[gnome-sudoku] sudoku-generator: fix warning about copying delegates



commit 94d2d6da95d2f41c26a7159c06aff67253c6d929
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Mon Sep 15 16:03:23 2014 -0500

    sudoku-generator: fix warning about copying delegates

 lib/sudoku-generator.vala |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/lib/sudoku-generator.vala b/lib/sudoku-generator.vala
index 100f6f6..05c0d6c 100644
--- a/lib/sudoku-generator.vala
+++ b/lib/sudoku-generator.vala
@@ -95,7 +95,7 @@ public class GeneratorThread : Object
     private int nsudokus;
     private DifficultyCategory level;
     private ArrayList<SudokuBoard> boards_list;
-    private SourceFunc callback;
+    private unowned SourceFunc callback;
 
     public GeneratorThread (int nsudokus, DifficultyCategory level, ref ArrayList<SudokuBoard> boards_list, 
SourceFunc callback)
     {
@@ -110,7 +110,11 @@ public class GeneratorThread : Object
         for (var i = 0; i < nsudokus; i++)
             boards_list.add (SudokuGenerator.generate_board (level));
 
-        Idle.add((owned) callback);
+        Idle.add(() => {
+            callback ();
+            return Source.REMOVE;
+        });
+
         return null;
     }
 }


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