mirror of
https://gitlab.com/mishakmak/pam-fprint-grosshack.git
synced 2026-04-08 20:03:34 +02:00
device: Unwatch names when removing them
If a device is unplugged/destroyed while a client is using it, then we would still end up watching the name. The vanish notification will then access the destroyed FprintDevice object. Fix this by unwatching the bus name when removing the client entry from the dictionary.
This commit is contained in:
@ -305,6 +305,11 @@ static void fprint_device_class_init(FprintDeviceClass *klass)
|
|||||||
quark_auth_user = g_quark_from_static_string ("authorized-user");
|
quark_auth_user = g_quark_from_static_string ("authorized-user");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void _unwatch_name (gpointer id)
|
||||||
|
{
|
||||||
|
g_bus_unwatch_name (GPOINTER_TO_INT (id));
|
||||||
|
}
|
||||||
|
|
||||||
static void fprint_device_init(FprintDevice *device)
|
static void fprint_device_init(FprintDevice *device)
|
||||||
{
|
{
|
||||||
FprintDevicePrivate *priv = fprint_device_get_instance_private(device);
|
FprintDevicePrivate *priv = fprint_device_get_instance_private(device);
|
||||||
@ -315,7 +320,7 @@ static void fprint_device_init(FprintDevice *device)
|
|||||||
priv->clients = g_hash_table_new_full (g_str_hash,
|
priv->clients = g_hash_table_new_full (g_str_hash,
|
||||||
g_str_equal,
|
g_str_equal,
|
||||||
g_free,
|
g_free,
|
||||||
NULL);
|
_unwatch_name);
|
||||||
|
|
||||||
g_signal_connect (device, "g-authorize-method",
|
g_signal_connect (device, "g-authorize-method",
|
||||||
G_CALLBACK (action_authorization_handler),
|
G_CALLBACK (action_authorization_handler),
|
||||||
|
|||||||
Reference in New Issue
Block a user