[gnome-builder] task: add some type safety to ide_task_set_task_data()



commit 67fc4b6955404eed79bf5dc18ce6bf98b7a67d28
Author: Christian Hergert <chergert redhat com>
Date:   Mon Jul 23 23:12:12 2018 -0700

    task: add some type safety to ide_task_set_task_data()
    
    This tries to ensure that the free func matches the type of the task
    data to give us some really basic type checking.

 src/libide/buffers/ide-buffer.c                          | 2 +-
 src/libide/buildsystem/ide-build-system.c                | 2 +-
 src/libide/config/ide-configuration-manager.c            | 4 ++--
 src/libide/devices/ide-device-manager.c                  | 2 +-
 src/libide/hover/ide-hover-context.c                     | 2 +-
 src/libide/ide-context.c                                 | 2 +-
 src/libide/runtimes/ide-runtime-manager.c                | 2 +-
 src/libide/search/ide-search-engine.c                    | 2 +-
 src/libide/sourceview/ide-source-view.c                  | 2 +-
 src/libide/threading/ide-task.c                          | 6 +++---
 src/libide/threading/ide-task.h                          | 8 ++++++++
 src/libide/toolchain/ide-toolchain-manager.c             | 2 +-
 src/libide/util/ide-async-helper.c                       | 2 +-
 src/libide/util/ide-glib.c                               | 2 +-
 src/plugins/c-pack/cpack-completion-results.c            | 2 +-
 src/plugins/clang/ide-clang-code-index-entries.c         | 2 +-
 src/plugins/clang/ide-clang-symbol-resolver.c            | 4 ++--
 src/plugins/cmake/gbp-cmake-toolchain-provider.c         | 2 +-
 src/plugins/code-index/ide-code-index-builder.c          | 8 ++++----
 src/plugins/code-index/ide-code-index-index.c            | 2 +-
 src/plugins/ctags/ide-ctags-results.c                    | 2 +-
 src/plugins/devhelp/gbp-devhelp-hover-provider.c         | 2 +-
 src/plugins/deviced/gbp-deviced-deploy-strategy.c        | 2 +-
 src/plugins/deviced/gbp-deviced-device.c                 | 2 +-
 src/plugins/flatpak/gbp-flatpak-application-addin.c      | 6 +++---
 src/plugins/flatpak/gbp-flatpak-configuration-provider.c | 4 ++--
 src/plugins/flatpak/gbp-flatpak-runtime-provider.c       | 2 +-
 src/plugins/gcc/gbp-gcc-toolchain-provider.c             | 2 +-
 src/plugins/meson/gbp-meson-build-system.c               | 2 +-
 src/plugins/meson/gbp-meson-toolchain-provider.c         | 2 +-
 src/plugins/spellcheck/gbp-spell-dict.c                  | 2 +-
 src/plugins/symbol-tree/gbp-symbol-layout-stack-addin.c  | 4 ++--
 src/plugins/todo/gbp-todo-model.c                        | 2 +-
 src/plugins/xml-pack/ide-xml-completion-provider.c       | 2 +-
 src/plugins/xml-pack/ide-xml-parser.c                    | 2 +-
 src/plugins/xml-pack/ide-xml-service.c                   | 2 +-
 src/plugins/xml-pack/ide-xml-tree-builder.c              | 2 +-
 src/tests/test-ide-task.c                                | 2 +-
 38 files changed, 56 insertions(+), 48 deletions(-)
---
diff --git a/src/libide/buffers/ide-buffer.c b/src/libide/buffers/ide-buffer.c
index c6c7e966d..b61bf9d47 100644
--- a/src/libide/buffers/ide-buffer.c
+++ b/src/libide/buffers/ide-buffer.c
@@ -2922,7 +2922,7 @@ ide_buffer_get_symbol_at_location_async (IdeBuffer           *self,
   ide_extension_set_adapter_foreach_by_priority (adapter, lookup_symbol_get_extension, data);
   g_assert (data->resolvers->len > 0);
 
-  ide_task_set_task_data (task, data, (GDestroyNotify)lookup_symbol_task_data_free);
+  ide_task_set_task_data (task, data, lookup_symbol_task_data_free);
 
   resolver = g_ptr_array_index (data->resolvers, data->resolvers->len - 1);
 
diff --git a/src/libide/buildsystem/ide-build-system.c b/src/libide/buildsystem/ide-build-system.c
index 1067071a8..15c64d07e 100644
--- a/src/libide/buildsystem/ide-build-system.c
+++ b/src/libide/buildsystem/ide-build-system.c
@@ -201,7 +201,7 @@ ide_build_system_real_get_build_flags_for_files_async (IdeBuildSystem       *sel
                                        g_object_unref,
                                        (GDestroyNotify)g_strfreev);
 
-  ide_task_set_task_data (task, data, (GDestroyNotify)get_build_flags_data_free);
+  ide_task_set_task_data (task, data, get_build_flags_data_free);
 
   ide_build_system_get_build_flags_async (self,
                                           g_ptr_array_index (files, 0),
diff --git a/src/libide/config/ide-configuration-manager.c b/src/libide/config/ide-configuration-manager.c
index 66f741835..9b51376e0 100644
--- a/src/libide/config/ide-configuration-manager.c
+++ b/src/libide/config/ide-configuration-manager.c
@@ -186,7 +186,7 @@ ide_configuration_manager_save_async (IdeConfigurationManager *self,
   peas_extension_set_foreach (self->providers,
                               ide_configuration_manager_collect_providers,
                               providers);
-  ide_task_set_task_data (task, g_ptr_array_ref (providers), (GDestroyNotify)g_ptr_array_unref);
+  ide_task_set_task_data (task, g_ptr_array_ref (providers), g_ptr_array_unref);
 
   if (providers->len == 0)
     ide_task_return_boolean (task, TRUE);
@@ -801,7 +801,7 @@ ide_configuration_manager_init_async (GAsyncInitable      *initable,
   peas_extension_set_foreach (self->providers,
                               ide_configuration_manager_collect_providers,
                               providers);
-  ide_task_set_task_data (task, g_ptr_array_ref (providers), (GDestroyNotify)g_ptr_array_unref);
+  ide_task_set_task_data (task, g_ptr_array_ref (providers), g_ptr_array_unref);
 
   for (guint i = 0; i < providers->len; i++)
     {
diff --git a/src/libide/devices/ide-device-manager.c b/src/libide/devices/ide-device-manager.c
index 2bb26816b..cc04e0956 100644
--- a/src/libide/devices/ide-device-manager.c
+++ b/src/libide/devices/ide-device-manager.c
@@ -957,7 +957,7 @@ ide_device_manager_deploy_async (IdeDeviceManager    *self,
   state = g_slice_new0 (DeployState);
   state->pipeline = g_object_ref (pipeline);
   state->strategies = g_ptr_array_new_with_free_func (g_object_unref);
-  ide_task_set_task_data (task, state, (GDestroyNotify)deploy_state_free);
+  ide_task_set_task_data (task, state, deploy_state_free);
 
   context = ide_object_get_context (IDE_OBJECT (self));
   set = peas_extension_set_new (peas_engine_get_default (),
diff --git a/src/libide/hover/ide-hover-context.c b/src/libide/hover/ide-hover-context.c
index a35362593..b71b3fb18 100644
--- a/src/libide/hover/ide-hover-context.c
+++ b/src/libide/hover/ide-hover-context.c
@@ -196,7 +196,7 @@ _ide_hover_context_query_async (IdeHoverContext     *self,
 
   q = g_slice_new0 (Query);
   q->active = self->providers->len;
-  ide_task_set_task_data (task, q, (GDestroyNotify)query_free);
+  ide_task_set_task_data (task, q, query_free);
 
   for (guint i = 0; i < self->providers->len; i++)
     {
diff --git a/src/libide/ide-context.c b/src/libide/ide-context.c
index 9ce46a15e..365879183 100644
--- a/src/libide/ide-context.c
+++ b/src/libide/ide-context.c
@@ -2279,7 +2279,7 @@ ide_context_restore_async (IdeContext          *self,
 
   self->restoring = TRUE;
 
-  ide_task_set_task_data (task, g_ptr_array_ref (ar), (GDestroyNotify)g_ptr_array_unref);
+  ide_task_set_task_data (task, g_ptr_array_ref (ar), g_ptr_array_unref);
 
   g_idle_add (restore_in_idle, g_object_ref (task));
 }
diff --git a/src/libide/runtimes/ide-runtime-manager.c b/src/libide/runtimes/ide-runtime-manager.c
index 0d7434c7b..261f09d4d 100644
--- a/src/libide/runtimes/ide-runtime-manager.c
+++ b/src/libide/runtimes/ide-runtime-manager.c
@@ -356,7 +356,7 @@ _ide_runtime_manager_prepare_async (IdeRuntimeManager   *self,
   state = g_slice_new0 (PrepareState);
   state->runtime_id = g_strdup (runtime_id);
   state->pipeline = g_object_ref (pipeline);
-  ide_task_set_task_data (task, state, (GDestroyNotify)prepare_state_free);
+  ide_task_set_task_data (task, state, prepare_state_free);
 
   if (runtime_id == NULL)
     {
diff --git a/src/libide/search/ide-search-engine.c b/src/libide/search/ide-search-engine.c
index 45a15601d..d4816c0be 100644
--- a/src/libide/search/ide-search-engine.c
+++ b/src/libide/search/ide-search-engine.c
@@ -275,7 +275,7 @@ ide_search_engine_search_async (IdeSearchEngine     *self,
   r->task = task;
   r->store = g_list_store_new (IDE_TYPE_SEARCH_RESULT);
   r->outstanding = 0;
-  ide_task_set_task_data (task, r, (GDestroyNotify)request_destroy);
+  ide_task_set_task_data (task, r, request_destroy);
 
   peas_extension_set_foreach (self->extensions,
                               ide_search_engine_search_foreach,
diff --git a/src/libide/sourceview/ide-source-view.c b/src/libide/sourceview/ide-source-view.c
index 9aab28bc4..317ec5f34 100644
--- a/src/libide/sourceview/ide-source-view.c
+++ b/src/libide/sourceview/ide-source-view.c
@@ -5256,7 +5256,7 @@ ide_source_view_real_find_references (IdeSourceView *self)
   data = g_slice_new0 (FindReferencesTaskData);
   data->resolvers = g_ptr_array_new_with_free_func (g_object_unref);
   data->location = ide_buffer_get_insert_location (priv->buffer);
-  ide_task_set_task_data (task, data, (GDestroyNotify)find_references_task_data_free);
+  ide_task_set_task_data (task, data, find_references_task_data_free);
 
   ide_extension_set_adapter_foreach_by_priority (adapter, find_references_task_get_extension, data);
   g_assert (data->resolvers->len > 0);
diff --git a/src/libide/threading/ide-task.c b/src/libide/threading/ide-task.c
index 12820712b..f025a7669 100644
--- a/src/libide/threading/ide-task.c
+++ b/src/libide/threading/ide-task.c
@@ -1792,9 +1792,9 @@ ide_task_set_task_data_cb (gpointer data)
 }
 
 void
-ide_task_set_task_data (IdeTask        *self,
-                        gpointer        task_data,
-                        GDestroyNotify  task_data_destroy)
+(ide_task_set_task_data) (IdeTask        *self,
+                          gpointer        task_data,
+                          GDestroyNotify  task_data_destroy)
 {
   IdeTaskPrivate *priv = ide_task_get_instance_private (self);
   g_autoptr(IdeTaskData) old_task_data = NULL;
diff --git a/src/libide/threading/ide-task.h b/src/libide/threading/ide-task.h
index c02c76fb3..cef8a3f3f 100644
--- a/src/libide/threading/ide-task.h
+++ b/src/libide/threading/ide-task.h
@@ -177,6 +177,14 @@ void          ide_dump_tasks                     (void);
     ide_task_set_name (__ide_task, g_intern_static_string (G_STRLOC));             \
     __ide_task;                                                                    \
   })
+# define ide_task_set_task_data(t,d,n)                        \
+  G_STMT_START {                                              \
+    __typeof__((d)) __task_data = (d);                        \
+    (ide_task_set_task_data) ((t),                            \
+                              __task_data,                    \
+                              0 ? (((n) (__task_data)), NULL) \
+                                : ((GDestroyNotify)(n)));     \
+  } G_STMT_END
 #endif
 
 G_END_DECLS
diff --git a/src/libide/toolchain/ide-toolchain-manager.c b/src/libide/toolchain/ide-toolchain-manager.c
index e6071b073..582055e1a 100644
--- a/src/libide/toolchain/ide-toolchain-manager.c
+++ b/src/libide/toolchain/ide-toolchain-manager.c
@@ -335,7 +335,7 @@ ide_toolchain_manager_init_async (GAsyncInitable      *initable,
                               providers);
   ide_task_set_task_data (task,
                           g_ptr_array_ref (providers),
-                          (GDestroyNotify)g_ptr_array_unref);
+                          g_ptr_array_unref);
 
   default_toolchain = ide_simple_toolchain_new (context, "default", _("Default (Host operating system)"));
   idx = self->toolchains->len;
diff --git a/src/libide/util/ide-async-helper.c b/src/libide/util/ide-async-helper.c
index 4a048adb6..ce4109e14 100644
--- a/src/libide/util/ide-async-helper.c
+++ b/src/libide/util/ide-async-helper.c
@@ -90,7 +90,7 @@ ide_async_helper_run (gpointer             source_object,
   va_end (args);
 
   task = ide_task_new (source_object, cancellable, callback, user_data);
-  ide_task_set_task_data (task, funcs, (GDestroyNotify)g_ptr_array_unref);
+  ide_task_set_task_data (task, funcs, g_ptr_array_unref);
 
   step1 (source_object,
          cancellable,
diff --git a/src/libide/util/ide-glib.c b/src/libide/util/ide-glib.c
index 73a4889ec..f5a85a422 100644
--- a/src/libide/util/ide-glib.c
+++ b/src/libide/util/ide-glib.c
@@ -554,7 +554,7 @@ ide_g_file_find_with_depth_async (GFile               *file,
   f = g_slice_new0 (Find);
   f->spec = g_pattern_spec_new (pattern);
   f->depth = depth;
-  ide_task_set_task_data (task, f, (GDestroyNotify)find_free);
+  ide_task_set_task_data (task, f, find_free);
 
   if (f->spec == NULL)
     {
diff --git a/src/plugins/c-pack/cpack-completion-results.c b/src/plugins/c-pack/cpack-completion-results.c
index c1c0da77d..8e64760e8 100644
--- a/src/plugins/c-pack/cpack-completion-results.c
+++ b/src/plugins/c-pack/cpack-completion-results.c
@@ -370,7 +370,7 @@ cpack_completion_results_populate_async (CpackCompletionResults *self,
 
   task = ide_task_new (self, cancellable, callback, user_data);
   ide_task_set_source_tag (task, cpack_completion_results_populate_async);
-  ide_task_set_task_data (task, p, (GDestroyNotify)populate_free);
+  ide_task_set_task_data (task, p, populate_free);
 
   cpack_completion_results_populate (task);
 }
diff --git a/src/plugins/clang/ide-clang-code-index-entries.c 
b/src/plugins/clang/ide-clang-code-index-entries.c
index e5b77fa16..d6e60a666 100644
--- a/src/plugins/clang/ide-clang-code-index-entries.c
+++ b/src/plugins/clang/ide-clang-code-index-entries.c
@@ -145,7 +145,7 @@ ide_clang_code_index_entries_next_entries_async (IdeCodeIndexEntries *entries,
   ide_task_set_source_tag (task, ide_clang_code_index_entries_next_entries_async);
   ide_task_set_priority (task, G_PRIORITY_LOW + 1000);
   ide_task_set_kind (task, IDE_TASK_KIND_INDEXER);
-  ide_task_set_task_data (task, g_variant_ref (self->entries), (GDestroyNotify)g_variant_unref);
+  ide_task_set_task_data (task, g_variant_ref (self->entries), g_variant_unref);
 
   if (self->has_run)
     ide_task_return_pointer (task,
diff --git a/src/plugins/clang/ide-clang-symbol-resolver.c b/src/plugins/clang/ide-clang-symbol-resolver.c
index 7941aed33..0601c594c 100644
--- a/src/plugins/clang/ide-clang-symbol-resolver.c
+++ b/src/plugins/clang/ide-clang-symbol-resolver.c
@@ -126,7 +126,7 @@ ide_clang_symbol_resolver_lookup_symbol_async (IdeSymbolResolver   *resolver,
   ide_task_set_source_tag (task, ide_clang_symbol_resolver_lookup_symbol_async);
   ide_task_set_task_data (task,
                           ide_source_location_ref (location),
-                          (GDestroyNotify) ide_source_location_unref);
+                          ide_source_location_unref);
 
   context = ide_object_get_context (IDE_OBJECT (self));
   build_system = ide_context_get_build_system (context);
@@ -355,7 +355,7 @@ ide_clang_symbol_resolver_find_nearest_scope_async (IdeSymbolResolver   *symbol_
   ide_task_set_source_tag (task, ide_clang_symbol_resolver_find_nearest_scope_async);
   ide_task_set_task_data (task,
                           ide_source_location_ref (location),
-                          (GDestroyNotify) ide_source_location_unref);
+                          ide_source_location_unref);
 
   context = ide_object_get_context (IDE_OBJECT (self));
   build_system = ide_context_get_build_system (context);
diff --git a/src/plugins/cmake/gbp-cmake-toolchain-provider.c 
b/src/plugins/cmake/gbp-cmake-toolchain-provider.c
index f0d20de10..bab210538 100644
--- a/src/plugins/cmake/gbp-cmake-toolchain-provider.c
+++ b/src/plugins/cmake/gbp-cmake-toolchain-provider.c
@@ -126,7 +126,7 @@ load_find_files_cb (GObject      *object,
       return;
     }
 
-  ide_task_set_task_data (task, g_steal_pointer (&ret), (GDestroyNotify)g_ptr_array_unref);
+  ide_task_set_task_data (task, g_steal_pointer (&ret), g_ptr_array_unref);
   ide_task_run_in_thread (task, gbp_cmake_toolchain_provider_load_worker);
 }
 
diff --git a/src/plugins/code-index/ide-code-index-builder.c b/src/plugins/code-index/ide-code-index-builder.c
index 0d358c8a3..a956b7845 100644
--- a/src/plugins/code-index/ide-code-index-builder.c
+++ b/src/plugins/code-index/ide-code-index-builder.c
@@ -788,7 +788,7 @@ get_changes_async (IdeCodeIndexBuilder *self,
   gcd->index_dir = g_object_ref (index_dir);
   gcd->recursive = !!recursive;
   gcd->vcs = g_object_ref (vcs);
-  ide_task_set_task_data (task, gcd, (GDestroyNotify)get_changes_data_free);
+  ide_task_set_task_data (task, gcd, get_changes_data_free);
 
   g_queue_push_head (&gcd->directories, g_object_ref (data_dir));
 
@@ -1025,7 +1025,7 @@ add_entries_to_index_async (IdeCodeIndexBuilder     *self,
   task_data->map_builder = g_object_ref (map_builder);
   task_data->fuzzy_builder = g_object_ref (fuzzy_builder);
   task_data->file_id = file_id;
-  ide_task_set_task_data (task, task_data, (GDestroyNotify)add_entries_data_free);
+  ide_task_set_task_data (task, task_data, add_entries_data_free);
 
   ide_code_index_entries_next_entries_async (entries,
                                              cancellable,
@@ -1172,7 +1172,7 @@ index_directory_async (IdeCodeIndexBuilder *self,
   idd->index_dir = g_object_ref (index_dir);
   idd->fuzzy = dzl_fuzzy_index_builder_new ();
   idd->map = ide_persistent_map_builder_new ();
-  ide_task_set_task_data (task, idd, (GDestroyNotify)index_directory_data_free);
+  ide_task_set_task_data (task, idd, index_directory_data_free);
 
   g_hash_table_iter_init (&iter, build_flags);
 
@@ -1434,7 +1434,7 @@ ide_code_index_builder_build_async (IdeCodeIndexBuilder *self,
   bd->data_dir = g_object_ref (directory);
   bd->index_dir = g_steal_pointer (&index_dir);
   bd->build_system = g_object_ref (build_system);
-  ide_task_set_task_data (task, bd, (GDestroyNotify)build_data_free);
+  ide_task_set_task_data (task, bd, build_data_free);
 
   get_changes_async (self,
                      bd->data_dir,
diff --git a/src/plugins/code-index/ide-code-index-index.c b/src/plugins/code-index/ide-code-index-index.c
index 41ad157b5..1fbb5b2e6 100644
--- a/src/plugins/code-index/ide-code-index-index.c
+++ b/src/plugins/code-index/ide-code-index-index.c
@@ -447,7 +447,7 @@ ide_code_index_index_populate_async (IdeCodeIndexIndex   *self,
       data->query = g_strconcat (prefix, "\x1F", str[1], NULL);
     }
 
-  ide_task_set_task_data (task, data, (GDestroyNotify)populate_task_data_free);
+  ide_task_set_task_data (task, data, populate_task_data_free);
 
   locker = g_mutex_locker_new (&self->mutex);
 
diff --git a/src/plugins/ctags/ide-ctags-results.c b/src/plugins/ctags/ide-ctags-results.c
index db23da93c..42e6df95e 100644
--- a/src/plugins/ctags/ide-ctags-results.c
+++ b/src/plugins/ctags/ide-ctags-results.c
@@ -251,7 +251,7 @@ ide_ctags_results_populate_async (IdeCtagsResults     *self,
   for (guint i = 0; i < self->indexes->len; i++)
     g_ptr_array_add (p->indexes, g_object_ref (g_ptr_array_index (self->indexes, i)));
 
-  ide_task_set_task_data (task, p, (GDestroyNotify)populate_free);
+  ide_task_set_task_data (task, p, populate_free);
   ide_task_run_in_thread (task, ide_ctags_results_populate_worker);
 }
 
diff --git a/src/plugins/devhelp/gbp-devhelp-hover-provider.c 
b/src/plugins/devhelp/gbp-devhelp-hover-provider.c
index 3a2e03940..a64c251fb 100644
--- a/src/plugins/devhelp/gbp-devhelp-hover-provider.c
+++ b/src/plugins/devhelp/gbp-devhelp-hover-provider.c
@@ -193,7 +193,7 @@ gbp_devhelp_hover_provider_hover_async (IdeHoverProvider    *provider,
   h = g_slice_new0 (Hover);
   h->context = g_object_ref (context);
   h->word = _ide_text_iter_current_symbol (iter, NULL);
-  ide_task_set_task_data (task, h, (GDestroyNotify)hover_free);
+  ide_task_set_task_data (task, h, hover_free);
 
   buffer = IDE_BUFFER (gtk_text_iter_get_buffer (iter));
   g_assert (IDE_IS_BUFFER (buffer));
diff --git a/src/plugins/deviced/gbp-deviced-deploy-strategy.c 
b/src/plugins/deviced/gbp-deviced-deploy-strategy.c
index df77ea346..917e9eff1 100644
--- a/src/plugins/deviced/gbp-deviced-deploy-strategy.c
+++ b/src/plugins/deviced/gbp-deviced-deploy-strategy.c
@@ -341,7 +341,7 @@ gbp_deviced_deploy_strategy_deploy_async (IdeDeployStrategy     *strategy,
   state->progress = progress;
   state->progress_data = progress_data;
   state->progress_data_destroy = progress_data_destroy;
-  ide_task_set_task_data (task, state, (GDestroyNotify)deploy_state_free);
+  ide_task_set_task_data (task, state, deploy_state_free);
 
   /*
    * First make sure we've built up to the point where we have a
diff --git a/src/plugins/deviced/gbp-deviced-device.c b/src/plugins/deviced/gbp-deviced-device.c
index 116f6bdf1..ee2a37b32 100644
--- a/src/plugins/deviced/gbp-deviced-device.c
+++ b/src/plugins/deviced/gbp-deviced-device.c
@@ -627,7 +627,7 @@ gbp_deviced_device_install_bundle_async (GbpDevicedDevice      *self,
   state->progress = progress;
   state->progress_data = progress_data;
   state->progress_data_destroy = progress_data_destroy;
-  ide_task_set_task_data (task, state, (GDestroyNotify)install_bundle_state_free);
+  ide_task_set_task_data (task, state, install_bundle_state_free);
 
   gbp_deviced_device_get_client_async (self,
                                        cancellable,
diff --git a/src/plugins/flatpak/gbp-flatpak-application-addin.c 
b/src/plugins/flatpak/gbp-flatpak-application-addin.c
index dd6cc918f..f78c5cfa4 100644
--- a/src/plugins/flatpak/gbp-flatpak-application-addin.c
+++ b/src/plugins/flatpak/gbp-flatpak-application-addin.c
@@ -205,7 +205,7 @@ copy_devhelp_docs_into_user_data_dir (GbpFlatpakApplicationAddin *self)
         }
     }
 
-  ide_task_set_task_data (task, g_steal_pointer (&paths), (GDestroyNotify)g_ptr_array_unref);
+  ide_task_set_task_data (task, g_steal_pointer (&paths), g_ptr_array_unref);
 
   /* Now go copy the the docs over */
   ide_task_run_in_thread (task, copy_devhelp_docs_into_user_data_dir_worker);
@@ -788,7 +788,7 @@ gbp_flatpak_application_addin_install_runtime_async (GbpFlatpakApplicationAddin
 
   task = ide_task_new (self, cancellable, callback, user_data);
   ide_task_set_source_tag (task, gbp_flatpak_application_addin_install_runtime_async);
-  ide_task_set_task_data (task, request, (GDestroyNotify)install_request_free);
+  ide_task_set_task_data (task, request, install_request_free);
 
   g_signal_connect_object (task,
                            "notify::completed",
@@ -1183,7 +1183,7 @@ gbp_flatpak_application_addin_locate_sdk_async (GbpFlatpakApplicationAddin  *sel
   locate->branch = g_strdup (branch);
   locate->installations = g_ptr_array_ref (self->installations);
 
-  ide_task_set_task_data (task, locate, (GDestroyNotify)locate_sdk_free);
+  ide_task_set_task_data (task, locate, locate_sdk_free);
   ide_task_run_in_thread (task, gbp_flatpak_application_addin_locate_sdk_worker);
 
   IDE_EXIT;
diff --git a/src/plugins/flatpak/gbp-flatpak-configuration-provider.c 
b/src/plugins/flatpak/gbp-flatpak-configuration-provider.c
index 90945ec89..735f414c9 100644
--- a/src/plugins/flatpak/gbp-flatpak-configuration-provider.c
+++ b/src/plugins/flatpak/gbp-flatpak-configuration-provider.c
@@ -122,7 +122,7 @@ gbp_flatpak_configuration_provider_save_async (IdeConfigurationProvider *provide
         g_ptr_array_add (ar, g_object_ref (manifest));
     }
 
-  ide_task_set_task_data (task, g_steal_pointer (&ar), (GDestroyNotify)g_ptr_array_unref);
+  ide_task_set_task_data (task, g_steal_pointer (&ar), g_ptr_array_unref);
 
   manifest_save_tick (task);
 
@@ -363,7 +363,7 @@ load_find_files_cb (GObject      *object,
       return;
     }
 
-  ide_task_set_task_data (task, g_steal_pointer (&ret), (GDestroyNotify)g_ptr_array_unref);
+  ide_task_set_task_data (task, g_steal_pointer (&ret), g_ptr_array_unref);
   ide_task_run_in_thread (task, gbp_flatpak_configuration_provider_load_worker);
 }
 
diff --git a/src/plugins/flatpak/gbp-flatpak-runtime-provider.c 
b/src/plugins/flatpak/gbp-flatpak-runtime-provider.c
index 5e5659f7d..3d865edf9 100644
--- a/src/plugins/flatpak/gbp-flatpak-runtime-provider.c
+++ b/src/plugins/flatpak/gbp-flatpak-runtime-provider.c
@@ -480,7 +480,7 @@ gbp_flatpak_runtime_provider_install_async (IdeRuntimeProvider  *provider,
   install->arch = g_steal_pointer (&arch);
   install->branch = g_steal_pointer (&branch);
 
-  ide_task_set_task_data (task, install, (GDestroyNotify)install_runtime_free);
+  ide_task_set_task_data (task, install, install_runtime_free);
 
   gbp_flatpak_application_addin_locate_sdk_async (gbp_flatpak_application_addin_get_default (),
                                                   install->id,
diff --git a/src/plugins/gcc/gbp-gcc-toolchain-provider.c b/src/plugins/gcc/gbp-gcc-toolchain-provider.c
index f23ad3003..9dfa19678 100644
--- a/src/plugins/gcc/gbp-gcc-toolchain-provider.c
+++ b/src/plugins/gcc/gbp-gcc-toolchain-provider.c
@@ -253,7 +253,7 @@ gbp_gcc_toolchain_provider_search_init (GbpGccToolchainProvider *self,
   fs = g_slice_new0 (FileSearching);
   fs->found_files = g_ptr_array_new_with_free_func (g_object_unref);
   fs->folders = folders;
-  ide_task_set_task_data (task, fs, (GDestroyNotify)file_searching_free);
+  ide_task_set_task_data (task, fs, file_searching_free);
 
   /* GCC */
   ide_g_file_find_async (folders->data,
diff --git a/src/plugins/meson/gbp-meson-build-system.c b/src/plugins/meson/gbp-meson-build-system.c
index 7a09c567d..a5349722c 100644
--- a/src/plugins/meson/gbp-meson-build-system.c
+++ b/src/plugins/meson/gbp-meson-build-system.c
@@ -611,7 +611,7 @@ gbp_meson_build_system_get_build_flags_for_files_async (IdeBuildSystem      *bui
   copy = g_ptr_array_new_with_free_func (g_object_unref);
   for (guint i = 0; i < files->len; i++)
     g_ptr_array_add (copy, g_object_ref (g_ptr_array_index (files, i)));
-  ide_task_set_task_data (task, g_steal_pointer (&copy), (GDestroyNotify)g_ptr_array_unref);
+  ide_task_set_task_data (task, g_steal_pointer (&copy), g_ptr_array_unref);
 
   gbp_meson_build_system_load_commands_async (self,
                                               cancellable,
diff --git a/src/plugins/meson/gbp-meson-toolchain-provider.c 
b/src/plugins/meson/gbp-meson-toolchain-provider.c
index 4ed7ce444..4bbe8c053 100644
--- a/src/plugins/meson/gbp-meson-toolchain-provider.c
+++ b/src/plugins/meson/gbp-meson-toolchain-provider.c
@@ -152,7 +152,7 @@ meson_toolchain_provider_search_finish (FileSearching *file_searching,
       return;
     }
 
-  ide_task_set_task_data (task, g_steal_pointer (&ret), (GDestroyNotify)g_ptr_array_unref);
+  ide_task_set_task_data (task, g_steal_pointer (&ret), g_ptr_array_unref);
   ide_task_run_in_thread (task, gbp_meson_toolchain_provider_load_worker);
 }
 
diff --git a/src/plugins/spellcheck/gbp-spell-dict.c b/src/plugins/spellcheck/gbp-spell-dict.c
index 6b5bd1d89..3747a210c 100644
--- a/src/plugins/spellcheck/gbp-spell-dict.c
+++ b/src/plugins/spellcheck/gbp-spell-dict.c
@@ -277,7 +277,7 @@ gbp_spell_dict_get_words_async (GbpSpellDict        *self,
 
   task = ide_task_new (self, cancellable, callback, user_data);
   ide_task_set_source_tag (task, gbp_spell_dict_get_words_async);
-  ide_task_set_task_data (task, state, (GDestroyNotify)task_state_free);
+  ide_task_set_task_data (task, state, task_state_free);
 
   dict_filename = g_strconcat (gspell_language_get_code (self->language), ".dic", NULL);
   path = g_build_filename (g_get_user_config_dir (), "enchant", dict_filename, NULL);
diff --git a/src/plugins/symbol-tree/gbp-symbol-layout-stack-addin.c 
b/src/plugins/symbol-tree/gbp-symbol-layout-stack-addin.c
index b53ca8570..079c9667c 100644
--- a/src/plugins/symbol-tree/gbp-symbol-layout-stack-addin.c
+++ b/src/plugins/symbol-tree/gbp-symbol-layout-stack-addin.c
@@ -176,7 +176,7 @@ gbp_symbol_layout_stack_addin_cursor_moved_cb (gpointer user_data)
           data->resolvers = g_ptr_array_new_with_free_func (g_object_unref);
           data->location = ide_buffer_get_insert_location (buffer);
           data->buffer = g_object_ref (buffer);
-          ide_task_set_task_data (task, data, (GDestroyNotify)symbol_resolver_task_data_free);
+          ide_task_set_task_data (task, data, symbol_resolver_task_data_free);
 
           ide_extension_set_adapter_foreach_by_priority (adapter, get_extension, data);
           g_assert (data->resolvers->len > 0);
@@ -324,7 +324,7 @@ gbp_symbol_layout_stack_addin_update_tree (GbpSymbolLayoutStackAddin *self,
   data = g_slice_new0 (SymbolResolverTaskData);
   data->resolvers = g_ptr_array_new_with_free_func (g_object_unref);
   data->buffer = g_object_ref (buffer);
-  ide_task_set_task_data (task, data, (GDestroyNotify)symbol_resolver_task_data_free);
+  ide_task_set_task_data (task, data, symbol_resolver_task_data_free);
 
   ide_extension_set_adapter_foreach_by_priority (adapter, get_extension, data);
   g_assert (data->resolvers->len > 0);
diff --git a/src/plugins/todo/gbp-todo-model.c b/src/plugins/todo/gbp-todo-model.c
index d2a3723bb..bfa58bfbf 100644
--- a/src/plugins/todo/gbp-todo-model.c
+++ b/src/plugins/todo/gbp-todo-model.c
@@ -672,7 +672,7 @@ gbp_todo_model_mine_async (GbpTodoModel        *self,
   m->file = g_object_ref (file);
   m->workdir = g_object_ref (workdir);
   m->use_git_grep = is_typed (self->vcs, "IdeGitVcs");
-  ide_task_set_task_data (task, m, (GDestroyNotify)mine_free);
+  ide_task_set_task_data (task, m, mine_free);
 
   ide_task_run_in_thread (task, gbp_todo_model_mine_worker);
 }
diff --git a/src/plugins/xml-pack/ide-xml-completion-provider.c 
b/src/plugins/xml-pack/ide-xml-completion-provider.c
index 09c61246e..e744bd740 100644
--- a/src/plugins/xml-pack/ide-xml-completion-provider.c
+++ b/src/plugins/xml-pack/ide-xml-completion-provider.c
@@ -1051,7 +1051,7 @@ ide_xml_completion_provider_populate_async (IdeCompletionProvider *provider,
   state->line = gtk_text_iter_get_line (&iter) + 1;
   state->line_offset = gtk_text_iter_get_line_offset (&iter) + 1;
 
-  ide_task_set_task_data (task, state, (GDestroyNotify)populate_state_free);
+  ide_task_set_task_data (task, state, populate_state_free);
 
   ide_xml_service_get_position_from_cursor_async (service,
                                                   state->ifile,
diff --git a/src/plugins/xml-pack/ide-xml-parser.c b/src/plugins/xml-pack/ide-xml-parser.c
index fddc03ca6..6af5faa98 100644
--- a/src/plugins/xml-pack/ide-xml-parser.c
+++ b/src/plugins/xml-pack/ide-xml-parser.c
@@ -645,7 +645,7 @@ ide_xml_parser_get_analysis_async (IdeXmlParser        *self,
   state->parent_node = state->root_node;
   ide_xml_stack_push (state->stack, "root", state->root_node, NULL, 0);
 
-  ide_task_set_task_data (task, state, (GDestroyNotify)parser_state_free);
+  ide_task_set_task_data (task, state, parser_state_free);
   ide_task_run_in_thread (task, ide_xml_parser_get_analysis_worker);
 }
 
diff --git a/src/plugins/xml-pack/ide-xml-service.c b/src/plugins/xml-pack/ide-xml-service.c
index 49ef14c4a..5aedbcff1 100644
--- a/src/plugins/xml-pack/ide-xml-service.c
+++ b/src/plugins/xml-pack/ide-xml-service.c
@@ -1026,7 +1026,7 @@ ide_xml_service_get_position_from_cursor_async (IdeXmlService       *self,
   state->line = line;
   state->line_offset = line_offset;
 
-  ide_task_set_task_data (task, state, (GDestroyNotify)position_state_free);
+  ide_task_set_task_data (task, state, position_state_free);
 
   ide_xml_service_get_analysis_async (self,
                                       ifile,
diff --git a/src/plugins/xml-pack/ide-xml-tree-builder.c b/src/plugins/xml-pack/ide-xml-tree-builder.c
index a4d0ec962..5fc624cc2 100644
--- a/src/plugins/xml-pack/ide-xml-tree-builder.c
+++ b/src/plugins/xml-pack/ide-xml-tree-builder.c
@@ -531,7 +531,7 @@ ide_xml_tree_builder_build_tree_async (IdeXmlTreeBuilder   *self,
 
   ide_task_set_task_data (task,
                           g_steal_pointer (&state),
-                          (GDestroyNotify)tree_builder_state_free);
+                          tree_builder_state_free);
 
   ide_xml_parser_get_analysis_async (self->parser,
                                      file,
diff --git a/src/tests/test-ide-task.c b/src/tests/test-ide-task.c
index 062b4a9f6..d10262f46 100644
--- a/src/tests/test-ide-task.c
+++ b/src/tests/test-ide-task.c
@@ -512,7 +512,7 @@ set_in_thread_worker (IdeTask      *task,
   /* its invalid to call set_task_data() after return, but okay here.
    * this obviously invalidates @task_data.
    */
-  ide_task_set_task_data (task, GINT_TO_POINTER (0x1234), NULL);
+  ide_task_set_task_data (task, GINT_TO_POINTER (0x1234), (GDestroyNotify)NULL);
   ide_task_return_boolean (task, TRUE);
 }
 


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