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().
This commit is contained in:
parent
eb059a789c
commit
85658965c9
@ -136,15 +136,8 @@ alsa_init(G_GNUC_UNUSED const struct audio_format *audio_format,
|
|||||||
const struct config_param *param,
|
const struct config_param *param,
|
||||||
G_GNUC_UNUSED GError **error)
|
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();
|
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);
|
alsa_configure(ad, param);
|
||||||
|
|
||||||
return ad;
|
return ad;
|
||||||
@ -156,6 +149,9 @@ alsa_finish(void *data)
|
|||||||
struct alsa_data *ad = data;
|
struct alsa_data *ad = data;
|
||||||
|
|
||||||
alsa_data_free(ad);
|
alsa_data_free(ad);
|
||||||
|
|
||||||
|
/* free libasound's config cache */
|
||||||
|
snd_config_update_free_global();
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
|
Loading…
Reference in New Issue
Block a user