diff options
author | Leandro Pereira <leandro@hardinfo.org> | 2010-01-03 22:24:20 -0200 |
---|---|---|
committer | Leandro Pereira <leandro@hardinfo.org> | 2010-01-03 22:24:20 -0200 |
commit | 7d8f97e3e07f65b90fed9a10de78cdb285acc455 (patch) | |
tree | f5a8460da0c05adae2c7e1582a717b7e38359656 /hardinfo2 | |
parent | 71c946914e692c1d2eda6f0dcdfdc1839789110b (diff) |
Fixed a bug that would crash the shell if there were ShellFieldUpdates timers pending after modules were unloaded.
Diffstat (limited to 'hardinfo2')
-rw-r--r-- | hardinfo2/shell.c | 36 | ||||
-rw-r--r-- | hardinfo2/shell.h | 1 | ||||
-rw-r--r-- | hardinfo2/util.c | 1 |
3 files changed, 22 insertions, 16 deletions
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); diff --git a/hardinfo2/shell.h b/hardinfo2/shell.h index 90e7bdc1..7f31c14c 100644 --- a/hardinfo2/shell.h +++ b/hardinfo2/shell.h @@ -197,6 +197,7 @@ void shell_view_set_enabled(gboolean setting); void shell_clear_timeouts(Shell *shell); void shell_clear_tree_models(Shell *shell); +void shell_clear_field_updates(void); void shell_set_title(Shell *shell, char *subtitle); void shell_add_modules_to_gui(gpointer _shell_module, gpointer _shell_tree); diff --git a/hardinfo2/util.c b/hardinfo2/util.c index 67277b53..131f667e 100644 --- a/hardinfo2/util.c +++ b/hardinfo2/util.c @@ -640,6 +640,7 @@ void module_unload_all(void) sync_manager_clear_entries(); shell_clear_timeouts(shell); shell_clear_tree_models(shell); + shell_clear_field_updates(); shell_set_title(shell, NULL); g_slist_free(shell->tree->modules); |