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.
This commit is contained in:
Benjamin Berg
2020-11-17 21:02:39 +01:00
parent 9c842e2c2f
commit e5c82d7b96

View File

@ -218,7 +218,14 @@ static void fprint_device_finalize(GObject *object)
session_data_set_new(priv, NULL, NULL); session_data_set_new(priv, NULL, NULL);
g_clear_object (&priv->auth); g_clear_object (&priv->auth);
g_clear_object (&priv->dev); 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); G_OBJECT_CLASS(fprint_device_parent_class)->finalize(object);
} }