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



commit 4bf6ebbab71c373cf90a8e7e0b71d9ed7187ee1b
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 286c288..0d3e2a2 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]