From bec97699f21d4dadcdc1a9f26985c699a374655d Mon Sep 17 00:00:00 2001 From: Cyrille Bagard Date: Thu, 14 Sep 2023 09:10:15 +0200 Subject: Handle Python bad plugins without name. --- plugins/pychrysalide/plugins/plugin.c | 2 ++ src/plugins/plugin.c | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/plugins/pychrysalide/plugins/plugin.c b/plugins/pychrysalide/plugins/plugin.c index 2488d21..340c617 100644 --- a/plugins/pychrysalide/plugins/plugin.c +++ b/plugins/pychrysalide/plugins/plugin.c @@ -579,6 +579,8 @@ static char *py_plugin_module_get_modname_wrapper(const GPluginModule *plugin) " script filename." \ ) + result = NULL; + gstate = PyGILState_Ensure(); pyobj = pygobject_new(G_OBJECT(plugin)); diff --git a/src/plugins/plugin.c b/src/plugins/plugin.c index 0281617..b96decd 100644 --- a/src/plugins/plugin.c +++ b/src/plugins/plugin.c @@ -820,6 +820,15 @@ char *g_plugin_module_get_modname(const GPluginModule *plugin) result = class->get_modname(plugin); + /** + * Tente une opération de la dernière chance. + * + * Dans le cas d'un module Python, la fonction de classe peut ne pas + * trouver de support si l'extension Python n'est pas au point. + */ + if (result == NULL && class->get_modname != _g_plugin_module_get_modname) + result = _g_plugin_module_get_modname(plugin); + return result; } -- cgit v0.11.2-87-g4458