Commit a17e1e6d authored by Debarshi Ray's avatar Debarshi Ray

gtask: Don't forget about the error after g_task_propagate_*

The use of past tense in g_task_had_error makes one assume that it
won't forget about any errors that might have occurred. Except, in
reality, it would.

Let's use a boolean flag to remember the error once it's been
propagated, as opposed to keeping the error around. This ensures that
the g_task_propagate_* methods continue to give invalid results when
called more than once, as mentioned in the documentation.
parent 1c6cd5f0
......@@ -569,6 +569,7 @@ struct _GTask {
gboolean boolean;
} result;
GDestroyNotify result_destroy;
gboolean had_error;
gboolean result_set;
......@@ -1497,6 +1498,7 @@ g_task_propagate_error (GTask *task,
g_propagate_error (error, task->error);
task->error = NULL;
task->had_error = TRUE;
return TRUE;
......@@ -1793,7 +1795,7 @@ g_task_return_error_if_cancelled (GTask *task)
g_task_had_error (GTask *task)
if (task->error != NULL)
if (task->error != NULL || task->had_error)
return TRUE;
if (task->check_cancellable && g_cancellable_is_cancelled (task->cancellable))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment