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:
parent
b3a4c2cf9a
commit
027ac8d843
2 changed files with 10 additions and 5 deletions
|
@ -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)
|
||||||
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
|
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
|
||||||
|
|
Loading…
Reference in a new issue