From 60d0f8429495e723b3b60652d74836541fad5fac Mon Sep 17 00:00:00 2001 From: Benjamin Berg Date: Tue, 2 Jun 2020 12:05:23 +0200 Subject: [PATCH] upeksonly: Fix creation of image transfers The GPtrArray needs to be created at some point. Also, reference counting was wrong as submitting the transfer sinks the ref, but we rely on it surviving. Note that we really should change this to only have one in-flight transfer and starting a new one after it finishes. Co-authored-by: Vasily Khoruzhick --- libfprint/drivers/upeksonly.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libfprint/drivers/upeksonly.c b/libfprint/drivers/upeksonly.c index 9dd3104..960edaa 100644 --- a/libfprint/drivers/upeksonly.c +++ b/libfprint/drivers/upeksonly.c @@ -560,7 +560,7 @@ img_data_cb (FpiUsbTransfer *transfer, FpDevice *device, if (is_capturing (self)) { - fpi_usb_transfer_submit (transfer, + fpi_usb_transfer_submit (fpi_usb_transfer_ref (transfer), 0, self->img_cancellable, img_data_cb, @@ -908,7 +908,7 @@ capsm_fire_bulk (FpiSsm *ssm, self->img_cancellable = g_cancellable_new (); for (i = 0; i < self->img_transfers->len; i++) { - fpi_usb_transfer_submit (g_ptr_array_index (self->img_transfers, i), + fpi_usb_transfer_submit (fpi_usb_transfer_ref (g_ptr_array_index (self->img_transfers, i)), 0, self->img_cancellable, img_data_cb, @@ -1406,8 +1406,9 @@ dev_activate (FpImageDevice *dev) self->capturing = FALSE; self->num_flying = 0; + self->img_transfers = g_ptr_array_new_with_free_func ((GFreeFunc) fpi_usb_transfer_unref); - for (i = 0; i < self->img_transfers->len; i++) + for (i = 0; i < NUM_BULK_TRANSFERS; i++) { FpiUsbTransfer *transfer;