[gnome-builder] ide-compile-coomand: protect file key against unref



commit 506df221f52541c4b5438b16a0c63e390fea1cff
Author: Sebastien Lafargue <slafargue gnome org>
Date:   Tue Oct 31 23:41:06 2017 +0100

    ide-compile-coomand: protect file key against unref
    
    When inserting in the info_by_file table the same file (the key)
    multiple times, we lost the last ref on it (keeped in the value)
    
    Using *_replace, we drop the old key for the new one.

 src/libide/buildsystem/ide-compile-commands.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/src/libide/buildsystem/ide-compile-commands.c b/src/libide/buildsystem/ide-compile-commands.c
index 31fa0a0..6411a09 100644
--- a/src/libide/buildsystem/ide-compile-commands.c
+++ b/src/libide/buildsystem/ide-compile-commands.c
@@ -250,7 +250,7 @@ ide_compile_commands_load_worker (GTask        *task,
       info->file = g_file_resolve_relative_path (dir, file);
       info->directory = g_object_ref (dir);
       info->command = g_strdup (command);
-      g_hash_table_insert (info_by_file, info->file, info);
+      g_hash_table_replace (info_by_file, info->file, info);
 
       /*
        * We might need to keep a special copy of this for resolving .vala


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