From 85658965c929b668dd5f75e5571654c488fca297 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 21 Apr 2009 22:47:12 +0200 Subject: alsa_output: don't use atexit() to clean up the ALSA library Call snd_config_update_free_global() manually in our finish() method, don't use atexit(). --- src/output/alsa_plugin.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/output/alsa_plugin.c b/src/output/alsa_plugin.c index 0295742e2..818c83ca2 100644 --- a/src/output/alsa_plugin.c +++ b/src/output/alsa_plugin.c @@ -136,15 +136,8 @@ alsa_init(G_GNUC_UNUSED const struct audio_format *audio_format, const struct config_param *param, G_GNUC_UNUSED GError **error) { - /* no need for pthread_once thread-safety when reading config */ - static int free_global_registered; struct alsa_data *ad = alsa_data_new(); - if (!free_global_registered) { - atexit((void(*)(void))snd_config_update_free_global); - free_global_registered = 1; - } - alsa_configure(ad, param); return ad; @@ -156,6 +149,9 @@ alsa_finish(void *data) struct alsa_data *ad = data; alsa_data_free(ad); + + /* free libasound's config cache */ + snd_config_update_free_global(); } static bool -- cgit v1.2.3