From 5f29b35fbef7f5f2d51b6b677f49c4a2a476a266 Mon Sep 17 00:00:00 2001 From: Ailin Nemui Date: Sat, 5 Feb 2022 22:31:42 +0100 Subject: [PATCH] fix crash when accessing settings during shutdown --- src/core/settings.c | 1 + src/fe-common/core/fe-common-core.c | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/core/settings.c b/src/core/settings.c index 28f953ba..1e7ef2ee 100644 --- a/src/core/settings.c +++ b/src/core/settings.c @@ -928,6 +928,7 @@ void settings_deinit(void) g_hash_table_foreach(settings, (GHFunc) settings_hash_free, NULL); g_hash_table_destroy(settings); + settings = NULL; if (mainconfig != NULL) config_close(mainconfig); } diff --git a/src/fe-common/core/fe-common-core.c b/src/fe-common/core/fe-common-core.c index a25c528c..9724354f 100644 --- a/src/fe-common/core/fe-common-core.c +++ b/src/fe-common/core/fe-common-core.c @@ -57,6 +57,7 @@ static int autocon_port; static int no_autoconnect; static char *cmdline_nick; static char *cmdline_hostname; +GLogFunc logger_old; void fe_core_log_init(void); void fe_core_log_deinit(void); @@ -253,6 +254,8 @@ void fe_common_core_deinit(void) signal_remove("server destroyed", (SIGNAL_FUNC) sig_destroyed); signal_remove("channel created", (SIGNAL_FUNC) sig_channel_created); signal_remove("channel destroyed", (SIGNAL_FUNC) sig_channel_destroyed); + + g_log_set_default_handler(logger_old, NULL); } static gboolean glib_domain_wanted(const char *domain) @@ -521,7 +524,7 @@ void fe_common_core_finish_init(void) signal_add_first("setup changed", (SIGNAL_FUNC) sig_setup_changed); /* _after_ windows are created.. */ - g_log_set_default_handler((GLogFunc) i_log_func, NULL); + logger_old = g_log_set_default_handler((GLogFunc) i_log_func, NULL); if (setup_changed) signal_emit("setup changed", 0);