summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2019-11-30 17:33:29 +0100
committerwm4 <wm4@nowhere>2019-11-30 17:33:29 +0100
commitcd9fe3a843e85259667b6b11f56c5f5c664c5948 (patch)
tree0cb41717ac06b1e8e259179847560936d1728994
parentfa9a1ff0a0f2ec0c37e27c30ad71ba814c7ada89 (diff)
downloadmpv-cd9fe3a843e85259667b6b11f56c5f5c664c5948.tar.bz2
mpv-cd9fe3a843e85259667b6b11f56c5f5c664c5948.tar.xz
m_config: remove change callback before unintialization
We don't want m_config uninitialization to call random change callbacks. This happens at the end of mp_destroy(), when almost everything else is already destroyed, and the change callbacks would probably trigger UB all over the place. The change callbacks could be trigger by m_config_restore_backups(), which is just used as a cheap way to free the remaining state. The worst is that this depends on which options may still have been part of this "backup" state, which depends on user input. Probably never a practical problem, since the backup state is most likely guaranteed to be empty before uninit is performed, but still.
-rw-r--r--options/m_config.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/options/m_config.c b/options/m_config.c
index a28ae4438b..68250c7e66 100644
--- a/options/m_config.c
+++ b/options/m_config.c
@@ -447,6 +447,7 @@ static struct m_config_shadow *m_config_shadow_new(const struct m_sub_options *r
static void config_destroy(void *p)
{
struct m_config *config = p;
+ config->option_change_callback = NULL;
m_config_restore_backups(config);
talloc_free(config->cache);