Clean up dlobj cache only when no user is present

Cleaning up the dlobj cache seems crashing some cases when the library
is used from another plugin like openal-soft.  A simple workaround is
to do the cleanup only when really no user is left, i.e. after all
close calls.

Bugzilla: https://bugzilla.novell.com/show_bug.cgi?id=814250

Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Takashi Iwai 2013-04-09 14:55:46 +02:00
parent a6813c2d0e
commit e79990ac5d

View file

@ -295,17 +295,24 @@ void snd_dlobj_cache_cleanup(void)
struct list_head *p, *npos;
struct dlobj_cache *c;
/* clean up caches only when really no user is present */
snd_dlobj_lock();
list_for_each(p, &pcm_dlobj_list) {
c = list_entry(p, struct dlobj_cache, list);
if (c->refcnt)
goto unlock;
}
list_for_each_safe(p, npos, &pcm_dlobj_list) {
c = list_entry(p, struct dlobj_cache, list);
if (c->refcnt == 0) {
list_del(p);
snd_dlclose(c->dlobj);
free((void *)c->name); /* shut up gcc warning */
free((void *)c->lib); /* shut up gcc warning */
free(c);
}
list_del(p);
snd_dlclose(c->dlobj);
free((void *)c->name); /* shut up gcc warning */
free((void *)c->lib); /* shut up gcc warning */
free(c);
}
unlock:
snd_dlobj_unlock();
}
#endif