[gnome-builder] code: short-circuit saving of the buffer



commit a552e285de01703fee32ca7da79f638cb949eb49
Author: Christian Hergert <chergert redhat com>
Date:   Fri Jan 18 11:53:44 2019 -0800

    code: short-circuit saving of the buffer
    
    This avoids a failure case when saving a buffer already in the state of
    saving.
    
    We might want to make this chain onto a previous task in the future, but
    for now this fixes #768

 src/libide/code/ide-buffer.c | 7 +++++++
 1 file changed, 7 insertions(+)
---
diff --git a/src/libide/code/ide-buffer.c b/src/libide/code/ide-buffer.c
index a4bfe4f71..9ae289ecf 100644
--- a/src/libide/code/ide-buffer.c
+++ b/src/libide/code/ide-buffer.c
@@ -1478,6 +1478,13 @@ ide_buffer_save_file_async (IdeBuffer            *self,
   ide_task_set_source_tag (task, ide_buffer_save_file_async);
   ide_task_set_task_data (task, state, save_state_free);
 
+  if (self->state == IDE_BUFFER_STATE_SAVING)
+    {
+      /* TODO: We could save in-flight tasks and chain to them */
+      ide_task_return_boolean (task, TRUE);
+      IDE_EXIT;
+    }
+
   if (self->state != IDE_BUFFER_STATE_READY)
     {
       ide_task_return_new_error (task,


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