From 5de1261df62d2e99687b9642a1959d23b963b7ee Mon Sep 17 00:00:00 2001 From: Benjamin Berg Date: Wed, 25 Nov 2020 18:48:09 +0100 Subject: [PATCH] device: Re-fetch session data after synchronous operation As the mainloop is iterated, the session-data may be modified while the client vanished handler is running. Re-fetch the session data to avoid seeing an old state and closing the device a second time. See: https://gitlab.freedesktop.org/libfprint/fprintd/-/issues/87#note_706357 --- src/device.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/device.c b/src/device.c index d5047ad..1c4cc3d 100644 --- a/src/device.c +++ b/src/device.c @@ -672,6 +672,8 @@ _fprint_device_client_vanished (GDBusConnection *connection, /* The session may have disappeared at this point if the device * was already closing. */ + g_clear_pointer (&session, session_data_unref); + session = session_data_get (priv); if (session && !fp_device_close_sync (priv->dev, NULL, &error)) g_critical ("Error closing device after disconnect: %s", error->message);