From adf4a8d487a46611f592a8189076cd2088fddeb0 Mon Sep 17 00:00:00 2001 From: Cyrille Bagard Date: Fri, 15 Nov 2024 10:54:42 +0100 Subject: Handle the case of unbuildable dynamic classes when freeing resources. --- src/plugins/dt.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/plugins/dt.c b/src/plugins/dt.c index 28b70bb..2899845 100644 --- a/src/plugins/dt.c +++ b/src/plugins/dt.c @@ -215,7 +215,24 @@ static void g_dynamic_types_dispose(GDynamicTypes *types) if (info->type != G_TYPE_INVALID) { g_class = g_type_class_peek(info->type); - g_type_class_unref(g_class); + + /** + * Constat est fait qu'un type implémenté en Python mais dont les + * instanciations conduisent toutes à des exceptions n'est pas + * associé à une classe à ce moment d'exécution. + * + * Cf. fonction testKnownFormatConstructor() de la suite de tests + * + * Cf. documentation de g_type_class_unref() également : + * + * """ + * Once the last reference count of a class has been released, + * classes may be finalized by the type system + * """ + */ + + if (g_class != NULL) + g_type_class_unref(g_class); info->type = G_TYPE_INVALID; -- cgit v0.11.2-87-g4458