mirror of
https://gitlab.freedesktop.org/libfprint/libfprint.git
synced 2026-05-07 06:28:03 +02:00
context: Ensure that context won't include a removed device at signal time
If a device has been removed from context, at that point we it should not be returned by fp_context_get_devices().
This commit is contained in:
parent
da9849613e
commit
d66e9470d8
2 changed files with 5 additions and 1 deletions
|
|
@ -96,8 +96,10 @@ remove_device (FpContext *context,
|
|||
|
||||
g_return_if_fail (g_ptr_array_find (priv->devices, device, &idx));
|
||||
|
||||
g_signal_emit (context, signals[DEVICE_REMOVED_SIGNAL], 0, device);
|
||||
g_object_ref (device);
|
||||
g_ptr_array_remove_index_fast (priv->devices, idx);
|
||||
g_signal_emit (context, signals[DEVICE_REMOVED_SIGNAL], 0, device);
|
||||
g_clear_object (&device);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -115,6 +115,8 @@ context_device_removed_cb (FpContext *ctx, FpDevice *device, FptContext *tctx)
|
|||
/* "device-removed" on context is always after "removed" on device */
|
||||
g_assert_cmpint (GPOINTER_TO_INT (tctx->user_data), ==, DEV_REMOVED_CB);
|
||||
tctx->user_data = GINT_TO_POINTER (CTX_DEVICE_REMOVED_CB);
|
||||
|
||||
g_assert_false (g_ptr_array_find (fp_context_get_devices (tctx->fp_context), device, NULL));
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue