From 7d8f97e3e07f65b90fed9a10de78cdb285acc455 Mon Sep 17 00:00:00 2001 From: Leandro Pereira Date: Sun, 3 Jan 2010 22:24:20 -0200 Subject: Fixed a bug that would crash the shell if there were ShellFieldUpdates timers pending after modules were unloaded. --- hardinfo2/shell.c | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) (limited to 'hardinfo2/shell.c') diff --git a/hardinfo2/shell.c b/hardinfo2/shell.c index 104c99a6..00c5d63c 100644 --- a/hardinfo2/shell.c +++ b/hardinfo2/shell.c @@ -1310,6 +1310,25 @@ void shell_set_note_from_entry(ShellModuleEntry * entry) } } +void shell_clear_field_updates(void) +{ + if (update_sfusrc) { + GSList *sfusrc; + + for (sfusrc = update_sfusrc; sfusrc; sfusrc = sfusrc->next) { + ShellFieldUpdateSource *src = + (ShellFieldUpdateSource *) sfusrc->data; + g_source_remove(src->source_id); + g_free(src->sfu->field_name); + g_free(src->sfu); + g_free(src); + } + + g_slist_free(update_sfusrc); + update_sfusrc = NULL; + } +} + static void module_selected_show_info(ShellModuleEntry * entry, gboolean reload) { @@ -1337,22 +1356,7 @@ module_selected_show_info(ShellModuleEntry * entry, gboolean reload) h_hash_table_remove_all(update_tbl); } - if (update_sfusrc) { - GSList *sfusrc; - - for (sfusrc = update_sfusrc; sfusrc; sfusrc = sfusrc->next) { - ShellFieldUpdateSource *src = - (ShellFieldUpdateSource *) sfusrc->data; - - g_source_remove(src->source_id); - g_free(src->sfu->field_name); - g_free(src->sfu); - g_free(src); - } - - g_slist_free(update_sfusrc); - update_sfusrc = NULL; - } + shell_clear_field_updates(); store = GTK_TREE_STORE(shell->info->model); -- cgit v1.2.3