[gnome-builder] clang: use copy of IdeFile for cache key



commit 825441bb9fef1931540cbb793e06dec610cc9a19
Author: Christian Hergert <chergert redhat com>
Date:   Fri May 13 15:58:39 2016 +0300

    clang: use copy of IdeFile for cache key
    
    While I don't really like our use of IdeFile in general, its a bit hard
    to remove from the codebase today. It can hold onto file-settings which
    we'd prefer to have disposed sooner rather than later. So use an IdeFile
    copy which won't have any of that attached to it.

 plugins/clang/ide-clang-service.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/plugins/clang/ide-clang-service.c b/plugins/clang/ide-clang-service.c
index 93630b1..ee2e65a 100644
--- a/plugins/clang/ide-clang-service.c
+++ b/plugins/clang/ide-clang-service.c
@@ -405,7 +405,10 @@ ide_clang_service_get_translation_unit_worker (EggTaskCache  *cache,
     }
 
   request = g_slice_new0 (ParseRequest);
-  request->file = g_object_ref (file);
+  /* Use a copy of the file so that our cache key does not
+   * include any file settings held by the IdeFile instance.
+   */
+  request->file = ide_file_new (context, gfile);
   request->index = self->index;
   request->source_filename = g_strdup (path);
   request->command_line_args = NULL;
@@ -433,7 +436,7 @@ ide_clang_service_get_translation_unit_worker (EggTaskCache  *cache,
    */
   IDE_TRACE_MSG ("Requesting build of translation unit");
   ide_build_system_get_build_flags_async (build_system,
-                                          file,
+                                          request->file,
                                           g_task_get_cancellable (task),
                                           ide_clang_service__get_build_flags_cb,
                                           g_object_ref (real_task));


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