mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-11-02 09:01:48 -05:00
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:
parent
a6813c2d0e
commit
e79990ac5d
1 changed files with 14 additions and 7 deletions
21
src/dlmisc.c
21
src/dlmisc.c
|
|
@ -295,17 +295,24 @@ void snd_dlobj_cache_cleanup(void)
|
||||||
struct list_head *p, *npos;
|
struct list_head *p, *npos;
|
||||||
struct dlobj_cache *c;
|
struct dlobj_cache *c;
|
||||||
|
|
||||||
|
/* clean up caches only when really no user is present */
|
||||||
snd_dlobj_lock();
|
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) {
|
list_for_each_safe(p, npos, &pcm_dlobj_list) {
|
||||||
c = list_entry(p, struct dlobj_cache, list);
|
c = list_entry(p, struct dlobj_cache, list);
|
||||||
if (c->refcnt == 0) {
|
list_del(p);
|
||||||
list_del(p);
|
snd_dlclose(c->dlobj);
|
||||||
snd_dlclose(c->dlobj);
|
free((void *)c->name); /* shut up gcc warning */
|
||||||
free((void *)c->name); /* shut up gcc warning */
|
free((void *)c->lib); /* shut up gcc warning */
|
||||||
free((void *)c->lib); /* shut up gcc warning */
|
free(c);
|
||||||
free(c);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unlock:
|
||||||
snd_dlobj_unlock();
|
snd_dlobj_unlock();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue