From c3e88f6e46c3cc4327be411861f264d16b655bc7 Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Tue, 16 Aug 2022 16:08:43 +0200 Subject: [PATCH] context: Fix race when shutting down context Fix possible race which would happen when freeing the devices array before cancelling the initialisation: (/builds/libfprint/libfprint/_build/tests/test-fp-context:1449): GLib-CRITICAL **: 14:00:19.640: g_ptr_array_add: assertion 'rarray' failed --- libfprint/fp-context.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libfprint/fp-context.c b/libfprint/fp-context.c index 42607dcb..34fcdda8 100644 --- a/libfprint/fp-context.c +++ b/libfprint/fp-context.c @@ -291,11 +291,10 @@ fp_context_finalize (GObject *object) FpContext *self = (FpContext *) object; FpContextPrivate *priv = fp_context_get_instance_private (self); - g_clear_pointer (&priv->devices, g_ptr_array_unref); - g_cancellable_cancel (priv->cancellable); g_clear_object (&priv->cancellable); g_clear_pointer (&priv->drivers, g_array_unref); + g_clear_pointer (&priv->devices, g_ptr_array_unref); g_slist_free_full (g_steal_pointer (&priv->sources), (GDestroyNotify) g_source_destroy);