mirror of
https://gitlab.freedesktop.org/libfprint/libfprint.git
synced 2026-09-10 13:00:08 +00:00
mafpmoc: Improve creation and destruction of templates list
This commit is contained in:
@@ -1875,9 +1875,7 @@ fp_list_tpl_table_cb (FpiDeviceMafpmoc *self,
|
|||||||
if (resp->result == MAFP_SUCCESS)
|
if (resp->result == MAFP_SUCCESS)
|
||||||
{
|
{
|
||||||
mafp_load_enrolled_ids (self, resp);
|
mafp_load_enrolled_ids (self, resp);
|
||||||
if (self->templates->list)
|
|
||||||
g_clear_pointer (&self->templates->list, g_object_unref);
|
|
||||||
self->templates->list = g_ptr_array_new_with_free_func (g_object_unref);
|
|
||||||
if (self->templates->total_num == 0)
|
if (self->templates->total_num == 0)
|
||||||
{
|
{
|
||||||
fpi_ssm_jump_to_state (self->task_ssm, FP_LIST_STATES);
|
fpi_ssm_jump_to_state (self->task_ssm, FP_LIST_STATES);
|
||||||
@@ -1951,6 +1949,7 @@ fp_list_ssm_done (FpiSsm *ssm, FpDevice *dev, GError *error)
|
|||||||
if (error)
|
if (error)
|
||||||
{
|
{
|
||||||
fp_dbg ("list tpl fail");
|
fp_dbg ("list tpl fail");
|
||||||
|
g_clear_pointer (&self->templates->list, g_ptr_array_unref);
|
||||||
fpi_device_list_complete (dev, NULL, g_steal_pointer (&error));
|
fpi_device_list_complete (dev, NULL, g_steal_pointer (&error));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -2351,6 +2350,8 @@ mafp_template_list (FpDevice *device)
|
|||||||
FpiDeviceMafpmoc *self = FPI_DEVICE_MAFPMOC (device);
|
FpiDeviceMafpmoc *self = FPI_DEVICE_MAFPMOC (device);
|
||||||
|
|
||||||
memset (self->templates, 0, sizeof (mafp_templates_t));
|
memset (self->templates, 0, sizeof (mafp_templates_t));
|
||||||
|
self->templates->list = g_ptr_array_new_with_free_func (g_object_unref);
|
||||||
|
|
||||||
self->task_ssm = fpi_ssm_new (device, fp_list_run_state, FP_LIST_STATES);
|
self->task_ssm = fpi_ssm_new (device, fp_list_run_state, FP_LIST_STATES);
|
||||||
if (!PRINT_SSM_DEBUG)
|
if (!PRINT_SSM_DEBUG)
|
||||||
fpi_ssm_silence_debug (self->task_ssm);
|
fpi_ssm_silence_debug (self->task_ssm);
|
||||||
|
|||||||
Reference in New Issue
Block a user