[gnome-builder] gcc: don't leak GFile from folder linked list
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] gcc: don't leak GFile from folder linked list
- Date: Sat, 28 Jul 2018 02:55:27 +0000 (UTC)
commit c4f9a0a3bde2f96901e29d78daa6211f77e87789
Author: Christian Hergert <chergert redhat com>
Date: Fri Jul 27 19:54:29 2018 -0700
gcc: don't leak GFile from folder linked list
src/plugins/gcc/gbp-gcc-toolchain-provider.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/src/plugins/gcc/gbp-gcc-toolchain-provider.c b/src/plugins/gcc/gbp-gcc-toolchain-provider.c
index 45f274a71..42bd13090 100644
--- a/src/plugins/gcc/gbp-gcc-toolchain-provider.c
+++ b/src/plugins/gcc/gbp-gcc-toolchain-provider.c
@@ -213,7 +213,14 @@ gbp_gcc_toolchain_provider_search_iterate (GObject *object,
IDE_PTR_ARRAY_SET_FREE_FUNC (ret, g_object_unref);
g_ptr_array_foreach (ret, (GFunc)add_all_files, fs->found_files);
- fs->folders = g_list_remove (fs->folders, file);
+
+ /* Remove the item from the list, ensuring we drop our
+ * reference from the linked-list too.
+ */
+ g_assert (fs->folders != NULL);
+ g_assert (fs->folders->data == (gpointer)file);
+ fs->folders = g_list_delete_link (fs->folders, fs->folders);
+ g_object_unref (file);
if (fs->folders != NULL)
ide_g_file_find_async (fs->folders->data,
@@ -252,11 +259,11 @@ 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;
+ fs->folders = g_steal_pointer (&folders);
ide_task_set_task_data (task, fs, file_searching_free);
/* GCC */
- ide_g_file_find_async (folders->data,
+ ide_g_file_find_async (fs->folders->data,
"*-gcc",
cancellable,
gbp_gcc_toolchain_provider_search_iterate,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]