From a63dcc96d591f9835445dd066321d195d17864e2 Mon Sep 17 00:00:00 2001 From: Benjamin Berg Date: Tue, 12 May 2020 19:15:23 +0200 Subject: [PATCH] virtual_image: Open a window for race conditions during open/close Delay the open/close callbacks by 100ms so that we have a window of opportunity for race conditions. This is needed to test certain conditiosn in fprintd. --- libfprint/drivers/virtual-image.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libfprint/drivers/virtual-image.c b/libfprint/drivers/virtual-image.c index 2962128..14156b1 100644 --- a/libfprint/drivers/virtual-image.c +++ b/libfprint/drivers/virtual-image.c @@ -288,7 +288,8 @@ dev_init (FpImageDevice *dev) start_listen (self); - fpi_image_device_open_complete (dev, NULL); + /* Delay result to open up the possibility of testing race conditions. */ + fpi_device_add_timeout (FP_DEVICE (dev), 100, (FpTimeoutFunc) fpi_image_device_open_complete, NULL, NULL); } static void @@ -303,7 +304,8 @@ dev_deinit (FpImageDevice *dev) g_clear_object (&self->listener); g_clear_object (&self->connection); - fpi_image_device_close_complete (dev, NULL); + /* Delay result to open up the possibility of testing race conditions. */ + fpi_device_add_timeout (FP_DEVICE (dev), 100, (FpTimeoutFunc) fpi_image_device_close_complete, NULL, NULL); } static void