mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Improve shutdown
1. close logfile as last action 2. Fix `plugins_shutdown()` accessing `((ProfPlugin*)curr->data)->lang` after `curr->data` had already potentially been free'd. Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
This commit is contained in:
parent
b250e3ec69
commit
e4d224d239
@ -932,21 +932,23 @@ void
|
|||||||
plugins_shutdown(void)
|
plugins_shutdown(void)
|
||||||
{
|
{
|
||||||
GList* values = g_hash_table_get_values(plugins);
|
GList* values = g_hash_table_get_values(plugins);
|
||||||
GList* curr = values;
|
GList *curr = values, *next;
|
||||||
|
|
||||||
while (curr) {
|
while (curr) {
|
||||||
|
next = g_list_next(curr);
|
||||||
#ifdef HAVE_PYTHON
|
#ifdef HAVE_PYTHON
|
||||||
if (((ProfPlugin*)curr->data)->lang == LANG_PYTHON) {
|
if (curr && ((ProfPlugin*)curr->data)->lang == LANG_PYTHON) {
|
||||||
python_plugin_destroy(curr->data);
|
python_plugin_destroy(curr->data);
|
||||||
|
curr = NULL;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_C
|
#ifdef HAVE_C
|
||||||
if (((ProfPlugin*)curr->data)->lang == LANG_C) {
|
if (curr && ((ProfPlugin*)curr->data)->lang == LANG_C) {
|
||||||
c_plugin_destroy(curr->data);
|
c_plugin_destroy(curr->data);
|
||||||
|
curr = NULL;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
curr = next;
|
||||||
curr = g_list_next(curr);
|
|
||||||
}
|
}
|
||||||
g_list_free(values);
|
g_list_free(values);
|
||||||
#ifdef HAVE_PYTHON
|
#ifdef HAVE_PYTHON
|
||||||
|
@ -256,9 +256,9 @@ _shutdown(void)
|
|||||||
accounts_close();
|
accounts_close();
|
||||||
tlscerts_close();
|
tlscerts_close();
|
||||||
log_stderr_close();
|
log_stderr_close();
|
||||||
log_close();
|
|
||||||
plugins_shutdown();
|
plugins_shutdown();
|
||||||
cmd_uninit();
|
cmd_uninit();
|
||||||
ui_close();
|
ui_close();
|
||||||
prefs_close();
|
prefs_close();
|
||||||
|
log_close();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user