diff --git a/libfprint/fpi-device.c b/libfprint/fpi-device.c index 6e2f1c2..88d752a 100644 --- a/libfprint/fpi-device.c +++ b/libfprint/fpi-device.c @@ -851,8 +851,6 @@ fpi_device_close_complete (FpDevice *device, GError *error) g_debug ("Device reported close completion"); clear_device_cancel_action (device); - priv->is_open = FALSE; - g_object_notify (G_OBJECT (device), "open"); switch (priv->type) { @@ -877,10 +875,16 @@ fpi_device_close_complete (FpDevice *device, GError *error) } if (!error) - fpi_device_return_task_in_idle (device, FP_DEVICE_TASK_RETURN_BOOL, - GUINT_TO_POINTER (TRUE)); + { + priv->is_open = FALSE; + g_object_notify (G_OBJECT (device), "open"); + fpi_device_return_task_in_idle (device, FP_DEVICE_TASK_RETURN_BOOL, + GUINT_TO_POINTER (TRUE)); + } else - fpi_device_return_task_in_idle (device, FP_DEVICE_TASK_RETURN_ERROR, error); + { + fpi_device_return_task_in_idle (device, FP_DEVICE_TASK_RETURN_ERROR, error); + } } /** diff --git a/tests/test-fpi-device.c b/tests/test-fpi-device.c index cd1cda6..f234e50 100644 --- a/tests/test-fpi-device.c +++ b/tests/test-fpi-device.c @@ -386,6 +386,7 @@ test_driver_close_error (void) g_assert (fake_dev->last_called_function == dev_class->close); g_assert_error (error, FP_DEVICE_ERROR, FP_DEVICE_ERROR_GENERAL); g_assert (error == g_steal_pointer (&fake_dev->ret_error)); + g_assert_true (fp_device_is_open (device)); } static void