Commit 412d818
Thread safety Vala disconnects signals automatically but not in a thread safe way. This happens when the Task object is destroyed in a background thread.
Changed files (5)
modifiedlibbirdfont/DrawingTools.valamodifiedlibbirdfont/Menu.valamodifiedlibbirdfont/MenuTab.valamodifiedlibbirdfont/Renderer/FallbackFont.valamodifiedlibbirdfont/Task.vala
Diff
@@ -772,8 +772,7 @@ public class DrawingTools : ToolCollection { auto_trace = new Tool ("autotrace", t_("Autotrace background image")); auto_trace.select_action.connect ((self) => {- Task t = new Task ();- t.task.connect (auto_trace_background);+ Task t = new Task (auto_trace_background); MainWindow.native_window.run_background_thread (t); }); @@ -168,8 +168,7 @@ public class Menu : AbstractMenu { MenuItem merge_paths = add_menu_item (t_("Merge Paths"), "merge_paths", "Glyph"); merge_paths.action.connect (() => {- Task t = new Task ();- t.task.connect (merge_selected_paths);+ Task t = new Task (merge_selected_paths); MainWindow.native_window.run_background_thread (t); show_menu = false;@@ -611,8 +611,7 @@ public class MenuTab : FontDisplay { return; } - Task t = new Task ();- t.task.connect (simplify);+ Task t = new Task (simplify); MainWindow.native_window.run_background_thread (t); } @@ -55,8 +55,7 @@ public class FallbackFont : GLib.Object { IdleSource idle = new IdleSource (); idle.set_callback (() => {- Task t = new Task ();- t.task.connect (init_font_config);+ Task t = new Task (init_font_config); MainWindow.native_window.run_non_blocking_background_thread (t); return false; });@@ -16,9 +16,11 @@ namespace BirdFont { public class Task : GLib.Object { - public signal void task ();+ public delegate void Runnable ();+ Runnable task; - public Task () {+ public Task (Runnable r) {+ task = r; } public void run () {