From 6eb9f263fd24338c20db8d74db59b662150045af Mon Sep 17 00:00:00 2001 From: Benjamin Berg Date: Fri, 13 Nov 2020 14:10:26 +0100 Subject: [PATCH] device: Disconnect authorization callback and remove clients Add a dispose function to disconnect the authorization callback and remove all clients (i.e. unwatch their bus names) before destroying the hash table. --- src/device.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/device.c b/src/device.c index 3dba53d..644d330 100644 --- a/src/device.c +++ b/src/device.c @@ -194,6 +194,21 @@ session_data_set_new (FprintDevicePrivate *priv, gchar *sender, gchar *username) return new; } +static void fprint_device_dispose(GObject *object) +{ + FprintDevice *self = (FprintDevice *) object; + FprintDevicePrivate *priv = fprint_device_get_instance_private(self); + + g_hash_table_remove_all (priv->clients); + g_object_disconnect (object, + "g-authorize-method", + G_CALLBACK (action_authorization_handler), + NULL, + NULL); + + G_OBJECT_CLASS(fprint_device_parent_class)->dispose(object); +} + static void fprint_device_finalize(GObject *object) { FprintDevice *self = (FprintDevice *) object; @@ -267,6 +282,7 @@ static void fprint_device_class_init(FprintDeviceClass *klass) GObjectClass *gobject_class = G_OBJECT_CLASS(klass); GParamSpec *pspec; + gobject_class->dispose = fprint_device_dispose; gobject_class->finalize = fprint_device_finalize; gobject_class->set_property = fprint_device_set_property; gobject_class->get_property = fprint_device_get_property;