diff --git a/src/plugins/plugins.c b/src/plugins/plugins.c index 3b64c7aa..274b711e 100644 --- a/src/plugins/plugins.c +++ b/src/plugins/plugins.c @@ -932,21 +932,23 @@ void plugins_shutdown(void) { GList* values = g_hash_table_get_values(plugins); - GList* curr = values; + GList *curr = values, *next; while (curr) { + next = g_list_next(curr); #ifdef HAVE_PYTHON - if (((ProfPlugin*)curr->data)->lang == LANG_PYTHON) { + if (curr && ((ProfPlugin*)curr->data)->lang == LANG_PYTHON) { python_plugin_destroy(curr->data); + curr = NULL; } #endif #ifdef HAVE_C - if (((ProfPlugin*)curr->data)->lang == LANG_C) { + if (curr && ((ProfPlugin*)curr->data)->lang == LANG_C) { c_plugin_destroy(curr->data); + curr = NULL; } #endif - - curr = g_list_next(curr); + curr = next; } g_list_free(values); #ifdef HAVE_PYTHON diff --git a/src/profanity.c b/src/profanity.c index 0731d711..9660945c 100644 --- a/src/profanity.c +++ b/src/profanity.c @@ -256,9 +256,9 @@ _shutdown(void) accounts_close(); tlscerts_close(); log_stderr_close(); - log_close(); plugins_shutdown(); cmd_uninit(); ui_close(); prefs_close(); + log_close(); }