diff --git a/libfprint/drivers/elan.c b/libfprint/drivers/elan.c index e2767dd..f9e8763 100644 --- a/libfprint/drivers/elan.c +++ b/libfprint/drivers/elan.c @@ -756,7 +756,7 @@ calibrate_run_state (FpiSsm *ssm, FpDevice *dev) self->calib_status = 0x01; timeout = fpi_device_add_timeout (dev, 50, fpi_ssm_next_state_timeout_cb, - ssm); + ssm, NULL); g_source_set_name (timeout, "calibrate_run_state"); } break; @@ -1020,7 +1020,7 @@ dev_change_state (FpImageDevice *dev, FpImageDeviceState state) self->dev_state_next = state; timeout = fpi_device_add_timeout (FP_DEVICE (dev), 10, elan_change_state_async, - NULL); + NULL, NULL); name = g_strdup_printf ("dev_change_state to %d", state); g_source_set_name (timeout, name); diff --git a/libfprint/drivers/uru4000.c b/libfprint/drivers/uru4000.c index 7e28724..1deadd3 100644 --- a/libfprint/drivers/uru4000.c +++ b/libfprint/drivers/uru4000.c @@ -875,7 +875,7 @@ rebootpwr_run_state (FpiSsm *ssm, FpDevice *_dev) break; case REBOOTPWR_PAUSE: - fpi_device_add_timeout (_dev, 10, rebootpwr_pause_cb, ssm); + fpi_device_add_timeout (_dev, 10, rebootpwr_pause_cb, ssm, NULL); break; } } @@ -971,7 +971,7 @@ powerup_run_state (FpiSsm *ssm, FpDevice *_dev) break; case POWERUP_PAUSE: - fpi_device_add_timeout (_dev, 10, powerup_pause_cb, ssm); + fpi_device_add_timeout (_dev, 10, powerup_pause_cb, ssm, NULL); break; case POWERUP_CHALLENGE_RESPONSE: @@ -1130,7 +1130,7 @@ init_run_state (FpiSsm *ssm, FpDevice *_dev) self->scanpwr_irq_timeout = fpi_device_add_timeout (_dev, 300, init_scanpwr_timeout, - ssm); + ssm, NULL); break; case INIT_DONE: diff --git a/libfprint/drivers/vfs0050.c b/libfprint/drivers/vfs0050.c index 43252c0..6377639 100644 --- a/libfprint/drivers/vfs0050.c +++ b/libfprint/drivers/vfs0050.c @@ -619,7 +619,7 @@ activate_ssm (FpiSsm *ssm, FpDevice *dev) /* Wait for probable vdev->active changing */ fpi_device_add_timeout (dev, VFS_SSM_TIMEOUT, - fpi_ssm_next_state_timeout_cb, ssm); + fpi_ssm_next_state_timeout_cb, ssm, NULL); break; case SSM_NEXT_RECEIVE: @@ -639,7 +639,7 @@ activate_ssm (FpiSsm *ssm, FpDevice *dev) case SSM_WAIT_ANOTHER_SCAN: /* Orange light is on now */ fpi_device_add_timeout (dev, VFS_SSM_ORANGE_TIMEOUT, - another_scan, ssm); + another_scan, ssm, NULL); break; default: diff --git a/libfprint/drivers/vfs101.c b/libfprint/drivers/vfs101.c index 5dedab7..0df9b73 100644 --- a/libfprint/drivers/vfs101.c +++ b/libfprint/drivers/vfs101.c @@ -376,7 +376,7 @@ async_sleep (unsigned int msec, FpImageDevice *dev) { fpi_device_add_timeout (FP_DEVICE (dev), msec, - fpi_ssm_next_state_timeout_cb, ssm); + fpi_ssm_next_state_timeout_cb, ssm, NULL); } /* Swap ssm states */ diff --git a/libfprint/drivers/vfs301.c b/libfprint/drivers/vfs301.c index 7219792..1d0f066 100644 --- a/libfprint/drivers/vfs301.c +++ b/libfprint/drivers/vfs301.c @@ -36,7 +36,7 @@ async_sleep (unsigned int msec, { /* Add timeout */ fpi_device_add_timeout (FP_DEVICE (dev), msec, - fpi_ssm_next_state_timeout_cb, ssm); + fpi_ssm_next_state_timeout_cb, ssm, NULL); } static int diff --git a/libfprint/drivers/vfs5011.c b/libfprint/drivers/vfs5011.c index dbf8276..4fac03c 100644 --- a/libfprint/drivers/vfs5011.c +++ b/libfprint/drivers/vfs5011.c @@ -706,7 +706,7 @@ activate_loop (FpiSsm *ssm, FpDevice *_dev) case DEV_ACTIVATE_DATA_COMPLETE: fpi_device_add_timeout (_dev, 1, fpi_ssm_next_state_timeout_cb, - ssm); + ssm, NULL); break; diff --git a/libfprint/fp-device.c b/libfprint/fp-device.c index 0a1f8de..182be51 100644 --- a/libfprint/fp-device.c +++ b/libfprint/fp-device.c @@ -1475,7 +1475,8 @@ fpi_device_set_scan_type (FpDevice *device, * @device: The #FpDevice * @interval: The interval in milliseconds * @func: The #FpTimeoutFunc to call on timeout - * @user_data: User data to pass to the callback + * @user_data: (nullable): User data to pass to the callback + * @destroy_notify: (nullable): #GDestroyNotify for @user_data * * Register a timeout to run. Drivers should always make sure that timers are * cancelled when appropriate. @@ -1483,10 +1484,11 @@ fpi_device_set_scan_type (FpDevice *device, * Returns: (transfer none): A newly created and attached #GSource */ GSource * -fpi_device_add_timeout (FpDevice *device, - gint interval, - FpTimeoutFunc func, - gpointer user_data) +fpi_device_add_timeout (FpDevice *device, + gint interval, + FpTimeoutFunc func, + gpointer user_data, + GDestroyNotify destroy_notify) { FpDevicePrivate *priv = fp_device_get_instance_private (device); FpDeviceTimeoutSource *source; @@ -1497,7 +1499,7 @@ fpi_device_add_timeout (FpDevice *device, source->user_data = user_data; g_source_attach (&source->source, NULL); - g_source_set_callback (&source->source, (GSourceFunc) func, user_data, NULL); + g_source_set_callback (&source->source, (GSourceFunc) func, user_data, destroy_notify); g_source_set_ready_time (&source->source, g_source_get_time (&source->source) + interval * (guint64) 1000); priv->sources = g_slist_prepend (priv->sources, source); diff --git a/libfprint/fpi-device.h b/libfprint/fpi-device.h index d83a5a3..2333ae2 100644 --- a/libfprint/fpi-device.h +++ b/libfprint/fpi-device.h @@ -203,11 +203,11 @@ void fpi_device_get_delete_data (FpDevice *device, GCancellable *fpi_device_get_cancellable (FpDevice *device); - -GSource * fpi_device_add_timeout (FpDevice *device, - gint interval, - FpTimeoutFunc func, - gpointer user_data); +GSource * fpi_device_add_timeout (FpDevice *device, + gint interval, + FpTimeoutFunc func, + gpointer user_data, + GDestroyNotify destroy_notify); void fpi_device_set_nr_enroll_stages (FpDevice *device, gint enroll_stages);