From e5c82d7b967b727d56cb01988139a43b8bf8e7a5 Mon Sep 17 00:00:00 2001 From: Benjamin Berg Date: Tue, 17 Nov 2020 21:02:39 +0100 Subject: [PATCH] device: Throw a critical warning if the device was not cleaned up On finalization, the device should always be cleaned up properly (no data associated with an action may be left). Show a critical warning if this is not the case, as it indicates a programming error. --- src/device.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/device.c b/src/device.c index 26f0242..d5047ad 100644 --- a/src/device.c +++ b/src/device.c @@ -218,7 +218,14 @@ static void fprint_device_finalize(GObject *object) session_data_set_new(priv, NULL, NULL); g_clear_object (&priv->auth); g_clear_object (&priv->dev); - /* FIXME close and stuff */ + + if (priv->current_action != ACTION_NONE || + priv->_session || + priv->verify_data || + priv->identify_data || + priv->current_cancellable || + priv->current_cancel_invocation) + g_critical("Device was not cleaned up properly before being finalized."); G_OBJECT_CLASS(fprint_device_parent_class)->finalize(object); }