[gnome-builder/wip/libide: 125/237] libide: try to be clever about returning errors.
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/libide: 125/237] libide: try to be clever about returning errors.
- Date: Tue, 17 Feb 2015 21:39:55 +0000 (UTC)
commit 1d63b7424364c69b69e9e37ba521eca9ae6946ad
Author: Christian Hergert <christian hergert me>
Date: Wed Feb 11 22:00:05 2015 -0800
libide: try to be clever about returning errors.
libide/ide-diagnostician.c | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/libide/ide-diagnostician.c b/libide/ide-diagnostician.c
index b72ee81..6db3bf7 100644
--- a/libide/ide-diagnostician.c
+++ b/libide/ide-diagnostician.c
@@ -32,6 +32,7 @@ typedef struct
typedef struct
{
IdeDiagnostics *diagnostics;
+ guint total;
guint active;
} DiagnoseState;
@@ -111,12 +112,12 @@ diagnose_cb (GObject *object,
ide_diagnostics_unref (ret);
maybe_complete:
- if (!state->active)
- {
- g_task_return_pointer (task,
- ide_diagnostics_ref (state->diagnostics),
- (GDestroyNotify)ide_diagnostics_unref);
- }
+ if (state->total == 1 && error)
+ g_task_return_error (task, error);
+ else if (!state->active)
+ g_task_return_pointer (task,
+ ide_diagnostics_ref (state->diagnostics),
+ (GDestroyNotify)ide_diagnostics_unref);
}
void
@@ -147,6 +148,7 @@ ide_diagnostician_diagnose_async (IdeDiagnostician *self,
state = g_slice_new0 (DiagnoseState);
state->active = priv->providers->len;
+ state->total = priv->providers->len;
state->diagnostics = _ide_diagnostics_new (NULL);
g_task_set_task_data (task, state, diagnose_state_free);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]