aboutsummaryrefslogtreecommitdiff
path: root/hardinfo2
diff options
context:
space:
mode:
authorLeandro Pereira <leandro@hardinfo.org>2010-01-03 20:08:09 -0200
committerLeandro Pereira <leandro@hardinfo.org>2010-01-03 20:08:09 -0200
commit71c946914e692c1d2eda6f0dcdfdc1839789110b (patch)
tree079be72e50061f879a72fd062535d0db7b0387b7 /hardinfo2
parent631f3ba3ffadaddd79cbbfc8c49b92aca58c2138 (diff)
Add hi_module_deinit() functions to more modules.
Diffstat (limited to 'hardinfo2')
-rw-r--r--hardinfo2/arch/common/printers.h2
-rw-r--r--hardinfo2/computer.c2
-rw-r--r--hardinfo2/devices.c8
-rw-r--r--hardinfo2/network.c17
-rw-r--r--hardinfo2/util.c6
5 files changed, 31 insertions, 4 deletions
diff --git a/hardinfo2/arch/common/printers.h b/hardinfo2/arch/common/printers.h
index 16063737..0e865c04 100644
--- a/hardinfo2/arch/common/printers.h
+++ b/hardinfo2/arch/common/printers.h
@@ -37,6 +37,7 @@ struct _CUPSDest {
static int (*cups_dests_get) (CUPSDest **dests) = NULL;
static int (*cups_dests_free) (int num_dests, CUPSDest *dests) = NULL;
static gboolean cups_init = FALSE;
+static GModule *cups = NULL;
static gboolean
remove_printer_devices(gpointer key, gpointer value, gpointer data)
@@ -47,7 +48,6 @@ remove_printer_devices(gpointer key, gpointer value, gpointer data)
static void
__init_cups(void)
{
- static GModule *cups = NULL;
const char *libcups[] = { "libcups", "libcups.so", "libcups.so.1", "libcups.so.2", NULL };
if (!(cups_dests_get && cups_dests_free)) {
diff --git a/hardinfo2/computer.c b/hardinfo2/computer.c
index bbab7060..8ec55c6b 100644
--- a/hardinfo2/computer.c
+++ b/hardinfo2/computer.c
@@ -583,8 +583,6 @@ gchar **hi_module_get_dependencies(void)
void hi_module_deinit(void)
{
- DEBUG("cleaning up module");
-
if (computer->os) {
g_free(computer->os->kernel);
g_free(computer->os->libc);
diff --git a/hardinfo2/devices.c b/hardinfo2/devices.c
index 4b29f80f..0607ba39 100644
--- a/hardinfo2/devices.c
+++ b/hardinfo2/devices.c
@@ -453,6 +453,14 @@ void hi_module_init(void)
__init_cups();
}
+void hi_module_deinit(void)
+{
+ h_hash_table_remove_all(moreinfo);
+ g_hash_table_destroy(moreinfo);
+ g_hash_table_destroy(memlabels);
+ g_module_close(cups);
+}
+
ModuleAbout *hi_module_get_about(void)
{
static ModuleAbout ma[] = {
diff --git a/hardinfo2/network.c b/hardinfo2/network.c
index 37ac3b06..243b7706 100644
--- a/hardinfo2/network.c
+++ b/hardinfo2/network.c
@@ -414,6 +414,23 @@ void hi_module_init(void)
g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
}
+void hi_module_deinit(void)
+{
+ h_hash_table_remove_all(moreinfo);
+ g_hash_table_destroy(moreinfo);
+
+ g_free(smb_shares_list);
+ g_free(nfs_shares_list);
+ g_free(network_interfaces);
+ g_free(network_icons);
+
+ g_free(__statistics);
+ g_free(__nameservers);
+ g_free(__arp_table);
+ g_free(__routing_table);
+ g_free(__connections);
+}
+
ModuleAbout *hi_module_get_about(void)
{
static ModuleAbout ma[] = {
diff --git a/hardinfo2/util.c b/hardinfo2/util.c
index 43a3677e..67277b53 100644
--- a/hardinfo2/util.c
+++ b/hardinfo2/util.c
@@ -593,8 +593,12 @@ static void module_unload(ShellModule * module)
if (module->dll) {
gchar *name;
- if (module->deinit)
+ if (module->deinit) {
+ DEBUG("cleaning up module \"%s\"", module->name);
module->deinit();
+ } else {
+ DEBUG("module \"%s\" does not need cleanup", module->name);
+ }
name = g_path_get_basename(g_module_name(module->dll));
g_hash_table_foreach_remove(__module_methods, remove_module_methods, name);