Handle idle cancellations properly

This commit is contained in:
Abhinav Baid 2024-09-03 22:56:09 +01:00 committed by Xelef2000
parent 923f04c817
commit c358306679

View file

@ -166,6 +166,9 @@ crfpmoc_read_bytes (gint fd, GIOCondition condition, gpointer user_data)
int rv;
struct crfpmoc_ec_response_get_next_event_v1 buffer = { 0 };
if (fd != self->fd)
return FALSE;
rv = read (fd, &buffer, sizeof (buffer));
if (rv == 0)
@ -314,6 +317,9 @@ crfpmoc_cancel (FpDevice *device)
fp_dbg ("Cancel");
FpiDeviceCrfpMoc *self = FPI_DEVICE_CRFPMOC (device);
if (self->task_ssm != NULL)
fpi_ssm_mark_failed (self->task_ssm, g_error_new_literal (G_IO_ERROR, G_IO_ERROR_CANCELLED, "Cancelled"));
crfpmoc_cmd_fp_mode (self, 0, NULL, NULL);
g_cancellable_cancel (self->interrupt_cancellable);