[gnome-builder] foundry: be flexible when device is destroyed or unrooted



commit f0aaa1dd801bdf19424911e155bbbdb000e9d5be
Author: Christian Hergert <chergert redhat com>
Date:   Thu Jan 10 13:09:38 2019 -0800

    foundry: be flexible when device is destroyed or unrooted

 src/libide/foundry/ide-build-manager.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/src/libide/foundry/ide-build-manager.c b/src/libide/foundry/ide-build-manager.c
index 5499557ea..52ab1ff9c 100644
--- a/src/libide/foundry/ide-build-manager.c
+++ b/src/libide/foundry/ide-build-manager.c
@@ -486,11 +486,18 @@ ide_build_manager_device_get_info_cb (GObject      *object,
   pipeline = ide_task_get_task_data (task);
   g_assert (IDE_IS_BUILD_PIPELINE (pipeline));
 
-  context = ide_object_get_context (IDE_OBJECT (pipeline));
-  g_assert (IDE_IS_CONTEXT (context));
+  if (ide_task_return_error_if_cancelled (task))
+    IDE_EXIT;
 
-  runtime_manager = ide_runtime_manager_from_context (context);
-  g_assert (IDE_IS_RUNTIME_MANAGER (runtime_manager));
+  if (!(context = ide_object_get_context (IDE_OBJECT (pipeline))) ||
+      !(runtime_manager = ide_runtime_manager_from_context (context)))
+    {
+      ide_task_return_new_error (task,
+                                 G_IO_ERROR,
+                                 G_IO_ERROR_CANCELLED,
+                                 "Device was destroyed");
+      IDE_EXIT;
+    }
 
   if (!(info = ide_device_get_info_finish (device, result, &error)))
     {


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