[gnome-builder] bufmgr: ensure context is alive during load and save ops



commit e9c4e5dc0d68ae656e5cc2e6173a912f1f25ed55
Author: Christian Hergert <chergert redhat com>
Date:   Wed Jan 13 17:24:03 2016 -0800

    bufmgr: ensure context is alive during load and save ops

 libide/ide-buffer-manager.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/libide/ide-buffer-manager.c b/libide/ide-buffer-manager.c
index cda1cb7..8abad96 100644
--- a/libide/ide-buffer-manager.c
+++ b/libide/ide-buffer-manager.c
@@ -729,6 +729,8 @@ ide_buffer_manager_load_file_async (IdeBufferManager     *self,
   task = g_task_new (self, cancellable, callback, user_data);
 
   context = ide_object_get_context (IDE_OBJECT (self));
+  ide_context_hold_for_object (context, task);
+
   buffer = ide_buffer_manager_get_buffer (self, file);
 
   /*
@@ -1037,6 +1039,7 @@ ide_buffer_manager_save_file_async  (IdeBufferManager     *self,
                                      gpointer              user_data)
 {
   g_autoptr(GTask) task = NULL;
+  IdeContext *context;
   SaveState *state;
 
   if (progress)
@@ -1049,6 +1052,9 @@ ide_buffer_manager_save_file_async  (IdeBufferManager     *self,
 
   task = g_task_new (self, cancellable, callback, user_data);
 
+  context = ide_object_get_context (IDE_OBJECT (self));
+  ide_context_hold_for_object (context, task);
+
   state = g_slice_new0 (SaveState);
   state->file = g_object_ref (file);
   state->buffer = g_object_ref (buffer);


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