diff options
-rw-r--r-- | src/core/core.c | 7 | ||||
-rw-r--r-- | src/core/demanglers.c | 6 | ||||
-rw-r--r-- | src/glibext/configuration.c | 8 | ||||
-rw-r--r-- | src/gui/core/core.c | 3 | ||||
-rw-r--r-- | src/plugins/dt.c | 33 | ||||
-rw-r--r-- | src/plugins/pglist.c | 11 | ||||
-rw-r--r-- | src/rost.c | 4 |
7 files changed, 49 insertions, 23 deletions
diff --git a/src/core/core.c b/src/core/core.c index 0fa2c74..7e48662 100644 --- a/src/core/core.c +++ b/src/core/core.c @@ -44,7 +44,6 @@ #include "../common/io.h" #include "../common/xdg.h" #include "../glibext/linesegment.h" -#include "../plugins/dt.h" @@ -123,8 +122,6 @@ bool load_all_core_components(bool cs) register_arch_gtypes(); init_operands_factory(); - if (result) result = init_chrysalide_dynamic_types(); - } } @@ -150,10 +147,10 @@ void unload_all_core_components(bool cs) { if (cs) { - exit_chrysalide_dynamic_types(); - exit_operands_factory(); + exit_segment_content_hash_table(); + unload_demanglers_definitions(); unload_processors_definitions(); diff --git a/src/core/demanglers.c b/src/core/demanglers.c index 0eb4e36..5518008 100644 --- a/src/core/demanglers.c +++ b/src/core/demanglers.c @@ -85,12 +85,12 @@ bool register_demangler_type(GType type) else { - _demanglers_definitions = (demangler_t *)realloc(_demanglers_definitions, - ++_demanglers_definitions_count * sizeof(demangler_t)); + _demanglers_definitions = realloc(_demanglers_definitions, + ++_demanglers_definitions_count * sizeof(demangler_t)); new = &_demanglers_definitions[_demanglers_definitions_count - 1]; - new->key = strdup(key); + new->key = key; new->type = type; result = true; diff --git a/src/glibext/configuration.c b/src/glibext/configuration.c index 5bc94a7..ce7fac8 100644 --- a/src/glibext/configuration.c +++ b/src/glibext/configuration.c @@ -1224,13 +1224,9 @@ static void g_generic_config_init(GGenConfig *config) static void g_generic_config_dispose(GGenConfig *config) { - g_list_free_full(config->groups, g_object_unref); + g_clear_list(&config->groups, g_object_unref); - config->groups = NULL; - - g_list_free_full(config->params, g_object_unref); - - config->params = NULL; + g_clear_list(&config->params, g_object_unref); G_OBJECT_CLASS(g_generic_config_parent_class)->dispose(G_OBJECT(config)); diff --git a/src/gui/core/core.c b/src/gui/core/core.c index c68b917..6bebfe2 100644 --- a/src/gui/core/core.c +++ b/src/gui/core/core.c @@ -32,7 +32,6 @@ #include "../menus/view.h" #include "../panels/welcome.h" #include "../../core/params.h" -#include "../../glibext/linesegment.h" #include "../../gtkext/tiledgrid.h" @@ -199,8 +198,6 @@ bool complete_loading_of_all_gui_components(GGenConfig *config) void unload_all_gui_components(void) { - exit_segment_content_hash_table(); - unload_all_themes(); } 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(); + } @@ -451,10 +451,10 @@ int main(int argc, char **argv) bad_file_content: - g_object_unref(G_OBJECT(scanner)); - } + g_clear_object(&scanner); + g_object_unref(G_OBJECT(options)); /* Sortie */ |