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.
This commit is contained in:
Marco Trevisan (Treviño) 2020-04-24 19:53:46 +02:00
parent 81e198c034
commit 5de49b33e6

View file

@ -171,7 +171,16 @@ fpi_image_device_minutiae_detected (GObject *source_object, GAsyncResult *res, g
print = fp_print_new (device); print = fp_print_new (device);
fpi_print_set_type (print, FPI_PRINT_NBIS); fpi_print_set_type (print, FPI_PRINT_NBIS);
if (!fpi_print_add_from_image (print, image, &error)) 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) if (action == FPI_DEVICE_ACTION_ENROLL)