mirror of
https://gitlab.freedesktop.org/libfprint/libfprint.git
synced 2025-11-15 07:38:12 +00:00
egismoc: Assert that task ssm is unset when setting it
We need to ensure that we are not overwriting the instance SSM, so that we can be sure that we are only doing one operation at time. Also we need to ensure that the task unsetting it, is the owner of it.
This commit is contained in:
@@ -149,7 +149,8 @@ egismoc_task_ssm_done (FpiSsm *ssm,
|
|||||||
fp_dbg ("Task SSM done");
|
fp_dbg ("Task SSM done");
|
||||||
FpiDeviceEgisMoc *self = FPI_DEVICE_EGISMOC (device);
|
FpiDeviceEgisMoc *self = FPI_DEVICE_EGISMOC (device);
|
||||||
|
|
||||||
/* task_ssm already freed by completion of SSM */
|
/* task_ssm is going to be freed by completion of SSM */
|
||||||
|
g_assert (!self->task_ssm || self->task_ssm == ssm);
|
||||||
self->task_ssm = NULL;
|
self->task_ssm = NULL;
|
||||||
|
|
||||||
g_clear_pointer (&self->enrolled_ids, g_ptr_array_unref);
|
g_clear_pointer (&self->enrolled_ids, g_ptr_array_unref);
|
||||||
@@ -325,6 +326,7 @@ egismoc_exec_cmd (FpDevice *device,
|
|||||||
g_autoptr(FpiUsbTransfer) transfer = NULL;
|
g_autoptr(FpiUsbTransfer) transfer = NULL;
|
||||||
CommandData *data = g_new0 (CommandData, 1);
|
CommandData *data = g_new0 (CommandData, 1);
|
||||||
|
|
||||||
|
g_assert (self->cmd_ssm == NULL);
|
||||||
self->cmd_ssm = fpi_ssm_new (device,
|
self->cmd_ssm = fpi_ssm_new (device,
|
||||||
egismoc_cmd_run_state,
|
egismoc_cmd_run_state,
|
||||||
CMD_STATES);
|
CMD_STATES);
|
||||||
@@ -499,6 +501,7 @@ egismoc_list (FpDevice *device)
|
|||||||
fp_dbg ("List");
|
fp_dbg ("List");
|
||||||
FpiDeviceEgisMoc *self = FPI_DEVICE_EGISMOC (device);
|
FpiDeviceEgisMoc *self = FPI_DEVICE_EGISMOC (device);
|
||||||
|
|
||||||
|
g_assert (self->task_ssm == NULL);
|
||||||
self->task_ssm = fpi_ssm_new (device,
|
self->task_ssm = fpi_ssm_new (device,
|
||||||
egismoc_list_run_state,
|
egismoc_list_run_state,
|
||||||
LIST_STATES);
|
LIST_STATES);
|
||||||
@@ -711,6 +714,7 @@ egismoc_clear_storage (FpDevice *device)
|
|||||||
fp_dbg ("Clear storage");
|
fp_dbg ("Clear storage");
|
||||||
FpiDeviceEgisMoc *self = FPI_DEVICE_EGISMOC (device);
|
FpiDeviceEgisMoc *self = FPI_DEVICE_EGISMOC (device);
|
||||||
|
|
||||||
|
g_assert (self->task_ssm == NULL);
|
||||||
self->task_ssm = fpi_ssm_new (device,
|
self->task_ssm = fpi_ssm_new (device,
|
||||||
egismoc_delete_run_state,
|
egismoc_delete_run_state,
|
||||||
DELETE_STATES);
|
DELETE_STATES);
|
||||||
@@ -726,6 +730,7 @@ egismoc_delete (FpDevice *device)
|
|||||||
|
|
||||||
fpi_device_get_delete_data (device, &delete_print);
|
fpi_device_get_delete_data (device, &delete_print);
|
||||||
|
|
||||||
|
g_assert (self->task_ssm == NULL);
|
||||||
self->task_ssm = fpi_ssm_new (device,
|
self->task_ssm = fpi_ssm_new (device,
|
||||||
egismoc_delete_run_state,
|
egismoc_delete_run_state,
|
||||||
DELETE_STATES);
|
DELETE_STATES);
|
||||||
@@ -1119,6 +1124,7 @@ egismoc_enroll (FpDevice *device)
|
|||||||
fpi_device_get_enroll_data (device, &enroll_print->print);
|
fpi_device_get_enroll_data (device, &enroll_print->print);
|
||||||
enroll_print->stage = 0;
|
enroll_print->stage = 0;
|
||||||
|
|
||||||
|
g_assert (self->task_ssm == NULL);
|
||||||
self->task_ssm = fpi_ssm_new (device, egismoc_enroll_run_state, ENROLL_STATES);
|
self->task_ssm = fpi_ssm_new (device, egismoc_enroll_run_state, ENROLL_STATES);
|
||||||
fpi_ssm_set_data (self->task_ssm, g_steal_pointer (&enroll_print), g_free);
|
fpi_ssm_set_data (self->task_ssm, g_steal_pointer (&enroll_print), g_free);
|
||||||
fpi_ssm_start (self->task_ssm, egismoc_task_ssm_done);
|
fpi_ssm_start (self->task_ssm, egismoc_task_ssm_done);
|
||||||
@@ -1306,6 +1312,7 @@ egismoc_identify_verify (FpDevice *device)
|
|||||||
fp_dbg ("Identify or Verify");
|
fp_dbg ("Identify or Verify");
|
||||||
FpiDeviceEgisMoc *self = FPI_DEVICE_EGISMOC (device);
|
FpiDeviceEgisMoc *self = FPI_DEVICE_EGISMOC (device);
|
||||||
|
|
||||||
|
g_assert (self->task_ssm == NULL);
|
||||||
self->task_ssm = fpi_ssm_new (device, egismoc_identify_run_state, IDENTIFY_STATES);
|
self->task_ssm = fpi_ssm_new (device, egismoc_identify_run_state, IDENTIFY_STATES);
|
||||||
fpi_ssm_start (self->task_ssm, egismoc_task_ssm_done);
|
fpi_ssm_start (self->task_ssm, egismoc_task_ssm_done);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user