summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2025-01-16 22:36:55 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2025-01-16 22:36:55 (GMT)
commit6a9390c5e4039c76f7348bc241de6df01c509cc0 (patch)
tree5baad68391166db657075e6fa1599b623a07b497 /src
parent64b690f0038e01e807c1ec8d62041057fd38b4b8 (diff)
Handle plugin destruction with more care.
Diffstat (limited to 'src')
-rw-r--r--src/plugins/plugin.c31
1 files changed, 19 insertions, 12 deletions
diff --git a/src/plugins/plugin.c b/src/plugins/plugin.c
index 9438f9f..b7f85d5 100644
--- a/src/plugins/plugin.c
+++ b/src/plugins/plugin.c
@@ -135,29 +135,36 @@ static void g_plugin_module_init(GPluginModule *plugin)
static void g_plugin_module_dispose(GPluginModule *plugin)
{
size_t i; /* Boucle de parcours */
+ size_t index; /* Indice de greffon visé */
GPluginModule *dependency; /* Module nécessaire */
GPluginModuleClass *class; /* Classe de l'instance active */
- lock_plugin_list_for_reading();
-
- for (i = 0; i < plugin->required_count; i++)
+ if (plugin->dependencies != NULL)
{
- dependency = get_plugin_by_name(plugin->required[i], NULL);
+ lock_plugin_list_for_reading();
- /* Si le chargement a bien été complet avant la sortie... */
- if (dependency != NULL)
+ for (i = 0; i < plugin->required_count; i++)
{
- /* Un coup pour l'appel à get_plugin_by_name(). */
- unref_object(dependency);
+ dependency = get_plugin_by_name(plugin->required[i], &index);
- /* Un coup pour la dépendance */
- unref_object(dependency);
+ /* Si la dépendance a bien été pris en compte... */
+ if (test_in_bit_field(plugin->dependencies, index))
+ {
+ assert(dependency != NULL);
+
+ /* Un coup pour l'appel à get_plugin_by_name(). */
+ unref_object(dependency);
+
+ /* Un coup pour la dépendance */
+ unref_object(dependency);
+
+ }
}
- }
+ unlock_plugin_list_for_reading();
- unlock_plugin_list_for_reading();
+ }
if (plugin->flags & PSF_LOADED)
{