[gnome-builder] autotools: make a copy of configuration



commit 1d0a3273d5b06a488778d23ae225225e4f28dc3e
Author: Christian Hergert <chergert redhat com>
Date:   Fri Oct 28 22:36:25 2016 -0700

    autotools: make a copy of configuration
    
    We don't want to allow the configuration to be changed out from under us,
    so we can just make a copy of it in case we want to access it from the
    worker thread.

 plugins/autotools/ide-autotools-build-task.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/plugins/autotools/ide-autotools-build-task.c b/plugins/autotools/ide-autotools-build-task.c
index 7f83d00..9939c8b 100644
--- a/plugins/autotools/ide-autotools-build-task.c
+++ b/plugins/autotools/ide-autotools-build-task.c
@@ -226,10 +226,17 @@ static void
 ide_autotools_build_task_set_configuration (IdeAutotoolsBuildTask *self,
                                             IdeConfiguration      *configuration)
 {
+  g_autoptr(IdeConfiguration) copy = NULL;
+
   g_assert (IDE_IS_AUTOTOOLS_BUILD_TASK (self));
   g_assert (IDE_IS_CONFIGURATION (configuration));
 
-  if (g_set_object (&self->configuration, configuration))
+  /* Work on a duplication of the configuration so that we don't need to
+   * synchronize with other threads. */
+  if (configuration != NULL)
+    copy = ide_configuration_duplicate (configuration);
+
+  if (g_set_object (&self->configuration, copy))
     g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_CONFIGURATION]);
 }
 


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