From 5d5995f2015acb9120cad4d3ccfbc61b9376e12e Mon Sep 17 00:00:00 2001 From: Benjamin Berg Date: Fri, 24 Apr 2020 17:56:45 +0200 Subject: [PATCH] image: Check for task success rather than just cancellation The minutiae detection might fail and we must not copy any data at that point. So check g_task_had_error to ensure that we only do so when the task was successful. Fixes: #251 --- libfprint/fp-image.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/libfprint/fp-image.c b/libfprint/fp-image.c index ac70d68..0bcee64 100644 --- a/libfprint/fp-image.c +++ b/libfprint/fp-image.c @@ -184,10 +184,8 @@ fp_image_detect_minutiae_cb (GObject *source_object, GTask *task = G_TASK (res); FpImage *image; DetectMinutiaeData *data = g_task_get_task_data (task); - GCancellable *cancellable; - cancellable = g_task_get_cancellable (task); - if (!cancellable || !g_cancellable_is_cancelled (cancellable)) + if (!g_task_had_error (task)) { gint i; image = FP_IMAGE (source_object);