mirror of
https://gitlab.freedesktop.org/libfprint/libfprint.git
synced 2025-11-15 07:38:12 +00:00
context: Use g_signal_connect_object for removal handling
Technically the API user might not keep the FpContext around after getting the device object. Really bad idea, but we shouldn't rely on that.
This commit is contained in:
@@ -147,9 +147,16 @@ device_removed_cb (FpContext *context, FpDevice *device)
|
|||||||
|
|
||||||
/* Wait for device close if the device is currently still open. */
|
/* Wait for device close if the device is currently still open. */
|
||||||
if (open)
|
if (open)
|
||||||
g_signal_connect_swapped (device, "notify::open", (GCallback) device_remove_on_notify_open_cb, context);
|
{
|
||||||
|
g_signal_connect_object (device, "notify::open",
|
||||||
|
(GCallback) device_remove_on_notify_open_cb,
|
||||||
|
context,
|
||||||
|
G_CONNECT_SWAPPED);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
remove_device (context, device);
|
{
|
||||||
|
remove_device (context, device);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -177,7 +184,10 @@ async_device_init_done_cb (GObject *source_object, GAsyncResult *res, gpointer u
|
|||||||
|
|
||||||
g_ptr_array_add (priv->devices, device);
|
g_ptr_array_add (priv->devices, device);
|
||||||
|
|
||||||
g_signal_connect_swapped (device, "removed", (GCallback) device_removed_cb, context);
|
g_signal_connect_object (device, "removed",
|
||||||
|
(GCallback) device_removed_cb,
|
||||||
|
context,
|
||||||
|
G_CONNECT_SWAPPED);
|
||||||
|
|
||||||
g_signal_emit (context, signals[DEVICE_ADDED_SIGNAL], 0, device);
|
g_signal_emit (context, signals[DEVICE_ADDED_SIGNAL], 0, device);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user