mirror of
https://gitlab.freedesktop.org/libfprint/libfprint.git
synced 2025-11-15 07:38:12 +00:00
fpi-device: Only mark a device as closed if the operation succeeded
We may fail during the close phase, in such case the device should not be marked as closed.
This commit is contained in:
@@ -851,8 +851,6 @@ fpi_device_close_complete (FpDevice *device, GError *error)
|
|||||||
g_debug ("Device reported close completion");
|
g_debug ("Device reported close completion");
|
||||||
|
|
||||||
clear_device_cancel_action (device);
|
clear_device_cancel_action (device);
|
||||||
priv->is_open = FALSE;
|
|
||||||
g_object_notify (G_OBJECT (device), "open");
|
|
||||||
|
|
||||||
switch (priv->type)
|
switch (priv->type)
|
||||||
{
|
{
|
||||||
@@ -877,10 +875,16 @@ fpi_device_close_complete (FpDevice *device, GError *error)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!error)
|
if (!error)
|
||||||
|
{
|
||||||
|
priv->is_open = FALSE;
|
||||||
|
g_object_notify (G_OBJECT (device), "open");
|
||||||
fpi_device_return_task_in_idle (device, FP_DEVICE_TASK_RETURN_BOOL,
|
fpi_device_return_task_in_idle (device, FP_DEVICE_TASK_RETURN_BOOL,
|
||||||
GUINT_TO_POINTER (TRUE));
|
GUINT_TO_POINTER (TRUE));
|
||||||
|
}
|
||||||
else
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -386,6 +386,7 @@ test_driver_close_error (void)
|
|||||||
g_assert (fake_dev->last_called_function == dev_class->close);
|
g_assert (fake_dev->last_called_function == dev_class->close);
|
||||||
g_assert_error (error, FP_DEVICE_ERROR, FP_DEVICE_ERROR_GENERAL);
|
g_assert_error (error, FP_DEVICE_ERROR, FP_DEVICE_ERROR_GENERAL);
|
||||||
g_assert (error == g_steal_pointer (&fake_dev->ret_error));
|
g_assert (error == g_steal_pointer (&fake_dev->ret_error));
|
||||||
|
g_assert_true (fp_device_is_open (device));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
Reference in New Issue
Block a user