From 5de49b33e619504fbf263328df270b9979f211f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Fri, 24 Apr 2020 19:53:46 +0200 Subject: [PATCH] image-device: Terminate the current action with error on print failure If we fail when setting the scanned image to a print, we'll have a fatal error, in such case we can terminate the current action and deactivate the device. --- libfprint/fpi-image-device.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/libfprint/fpi-image-device.c b/libfprint/fpi-image-device.c index 55b6488..8b37d8a 100644 --- a/libfprint/fpi-image-device.c +++ b/libfprint/fpi-image-device.c @@ -171,7 +171,16 @@ fpi_image_device_minutiae_detected (GObject *source_object, GAsyncResult *res, g print = fp_print_new (device); fpi_print_set_type (print, FPI_PRINT_NBIS); if (!fpi_print_add_from_image (print, image, &error)) - g_clear_object (&print); + { + g_clear_object (&print); + + if (error->domain != FP_DEVICE_RETRY) + { + fpi_device_action_error (device, error); + fpi_image_device_deactivate (self); + return; + } + } } if (action == FPI_DEVICE_ACTION_ENROLL)