diff options
Diffstat (limited to 'src/plugins')
| -rw-r--r-- | src/plugins/dt.c | 33 | ||||
| -rw-r--r-- | src/plugins/pglist.c | 11 | 
2 files changed, 40 insertions, 4 deletions
| diff --git a/src/plugins/dt.c b/src/plugins/dt.c index c476dde..d678637 100644 --- a/src/plugins/dt.c +++ b/src/plugins/dt.c @@ -204,6 +204,25 @@ static void g_dynamic_types_interface_init(GTypePluginClass *iface)  static void g_dynamic_types_dispose(GDynamicTypes *types)  { +    size_t i;                               /* Boucle de parcours          */ +    type_dyn_info_t *info;                  /* Information à exploiter     */ +    gpointer g_class;                       /* Classe à oublier            */ + +    for (i = 0; i < types->count; i++) +    { +        info = types->info[i]; + +        if (info->type != G_TYPE_INVALID) +        { +            g_class = g_type_class_peek(info->type); +            g_type_class_unref(g_class); + +            info->type = G_TYPE_INVALID; + +        } + +    } +      G_OBJECT_CLASS(g_dynamic_types_parent_class)->dispose(G_OBJECT(types));  } @@ -223,6 +242,14 @@ static void g_dynamic_types_dispose(GDynamicTypes *types)  static void g_dynamic_types_finalize(GDynamicTypes *types)  { +    size_t i;                               /* Boucle de parcours          */ + +    for (i = 0; i < types->count; i++) +        free(types->info[i]); + +    if (types->info != NULL) +        free(types->info); +      G_OBJECT_CLASS(g_dynamic_types_parent_class)->finalize(G_OBJECT(types));  } @@ -367,7 +394,7 @@ static type_dyn_info_t *g_dynamic_types_find(const GDynamicTypes *types, GType t  *                                                                             *  *  Description : Fournit un identifiant GLib pour un nouveau type.            *  *                                                                             * -*  Retour      : identifiant d'un nouveau type valide, ou 0.                  * +*  Retour      : identifiant d'un nouveau type valide, ou G_TYPE_INVALID.     *  *                                                                             *  *  Remarques   : -                                                            *  *                                                                             * @@ -382,7 +409,7 @@ static GType g_dynamic_types_register_type(GDynamicTypes *types, GType parent, c      result = g_type_register_dynamic(parent, name, G_TYPE_PLUGIN(types), 0); -    if (result == 0) +    if (result == G_TYPE_INVALID)          goto exit;      new = malloc(sizeof(type_dyn_info_t)); @@ -467,7 +494,7 @@ void exit_chrysalide_dynamic_types(void)  *                                                                             *  *  Description : Fournit un identifiant GLib pour un nouveau type.            *  *                                                                             * -*  Retour      : Identifiant d'un nouveau type valide, ou 0.                  * +*  Retour      : Identifiant d'un nouveau type valide, ou G_TYPE_INVALID.     *  *                                                                             *  *  Remarques   : -                                                            *  *                                                                             * diff --git a/src/plugins/pglist.c b/src/plugins/pglist.c index 9931eec..6b36d2f 100644 --- a/src/plugins/pglist.c +++ b/src/plugins/pglist.c @@ -35,6 +35,7 @@  #include <i18n.h> +#include "dt.h"  #include "plugin-int.h"  #include "../common/extstr.h"  #include "../core/logs.h" @@ -75,11 +76,15 @@ static void on_plugin_ref_toggle(gpointer, GPluginModule *, gboolean);  bool init_all_plugins(bool load)  { +    bool result;                            /* Bilan à retourner           */      char *edir;                             /* Répertoire de base effectif */      char *env;                              /* Contenu environnemental     */      char *saveptr;                          /* Sauvegarde pour parcours    */      char *udir;                             /* Répertoire supplémentaire ? */ +    result = init_chrysalide_dynamic_types(); +    if (!result) goto exit; +      g_rw_lock_init(&_pg_lock);      edir = get_effective_directory_new(TDT_PLUGINS_LIB); @@ -102,7 +107,9 @@ bool init_all_plugins(bool load)      if (load)          load_remaning_plugins(); -    return true; + exit: + +    return result;  } @@ -178,6 +185,8 @@ void exit_all_plugins(void)      g_rw_lock_clear(&_pg_lock); +    exit_chrysalide_dynamic_types(); +  } | 
