From e3b0d52ce504e9f0b10755bfbc329c79bd6a5519 Mon Sep 17 00:00:00 2001 From: Benjamin Berg Date: Wed, 11 Aug 2021 10:43:57 +0200 Subject: [PATCH] device: Catch client disconnect during Release If the client disconnected while the release call was stopping the current action, then the disconnect will be processed. This means that the device can be closed already and the session is destroyed. Add a check for this, in the same way that the vanished handler deals with this corner case. --- src/device.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/device.c b/src/device.c index d505761..5b65a24 100644 --- a/src/device.c +++ b/src/device.c @@ -1171,6 +1171,14 @@ fprint_device_release (FprintDBusDevice *dbus_dev, } session = session_data_get (priv); + + /* We iterated the mainloop, the session may have disappeared already. */ + if (!session) + { + fprint_dbus_device_complete_release (FPRINT_DBUS_DEVICE (rdev), invocation); + return TRUE; + } + session->invocation = g_object_ref (invocation); priv->current_action = ACTION_CLOSE;