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
This commit is contained in:
Benjamin Berg
2020-11-25 18:48:09 +01:00
parent e5c82d7b96
commit 5de1261df6

View File

@ -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);