From 74f8a8ee27f6356ae86a7fe14e439ac554bc86da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Thu, 28 Jan 2021 11:32:46 +0100 Subject: [PATCH] virtual-device: Handle cancelled state gracefully in should_wait_to_sleep --- libfprint/drivers/virtual-device.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libfprint/drivers/virtual-device.c b/libfprint/drivers/virtual-device.c index 1acfcfe..17c7786 100644 --- a/libfprint/drivers/virtual-device.c +++ b/libfprint/drivers/virtual-device.c @@ -469,7 +469,11 @@ should_wait_to_sleep (FpDeviceVirtualDevice *self, if (g_str_has_prefix (cmd, SLEEP_CMD_PREFIX)) { - g_free (process_cmds (self, FALSE, NULL)); + g_autoptr(GError) local_error = NULL; + g_free (process_cmds (self, FALSE, &local_error)); + + if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) + return FALSE; g_assert (!self->injected_synthetic_cmd); g_assert (self->sleep_timeout_id != 0);