1
0
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:
Steffen Jaeckel 2023-11-17 13:49:48 +01:00
parent b250e3ec69
commit e4d224d239
2 changed files with 8 additions and 6 deletions

View File

@ -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

View File

@ -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();
}