tags 563192 + patch thanks Hi,
I agree with Max that portaudio shouldn't be setting the error handler, much less to a function that just discards errors (ALSA's default error handler prints errors to stderr). Please mention this to upstream. That said, I don't think that there's an actual application trying to set its own error handler, since the whole point of portaudio is abstracting ALSA (or OSS, or ...) away. But in the spirit of not divering too much from upstream, I'm attaching a patch that cleans up the error handler in case portaudio is terminating. The way I read the code, the Terminate function will be called on library unloading. I didn't look at MPD (the case Max mentioned) to see if this is the actual path taken in that case. Cheers, Marcelo
diff --git a/src/hostapi/alsa/pa_linux_alsa.c b/src/hostapi/alsa/pa_linux_alsa.c index 0842bb4..665be18 100644 --- a/src/hostapi/alsa/pa_linux_alsa.c +++ b/src/hostapi/alsa/pa_linux_alsa.c @@ -304,6 +304,8 @@ static void Terminate( struct PaUtilHostApiRepresentation *hostApi ) assert( hostApi ); + snd_lib_error_set_handler(NULL); + if( alsaHostApi->allocations ) { PaUtil_FreeAllAllocations( alsaHostApi->allocations );