On Mon, 5 Jun 2006, ZIGLIO, Frediano, VF-IT wrote:
Well,
to sum up the problem with dsound (Windows audio driver), qemu crash
when is closed using "X" in console window. The reason is quite
complicated:
- in audio/dsoundaudio.c you allocate a IDirectSound* using
CoCreateInstance
- in audio/audio.c AUD_init you set up a atexit handler
- you close console window with X
- windows start to cleanup DLLs
- dsound depend on msvcrt so it clean dsound before msvcrt
- dsound free allocate resources
- msvcrt is cleaned, is calls atexit functions
- audio.c audio_atexit calls dsoundaudio.c dsound_audio_fini witch
should call dsound functions to free structures however dsound.dll is
not loaded and memory is already freed by dsound... so qemu crash.
I proposed a workaround to call SetConsoleCtrlHandler in main to catch
console close before dll unload. Another solution would be to not
deallocate dsound in dsound_audio_fini but I think that
SetConsoleCtrlHandler solution is cleaner and better. I don't understand
why ctrl-c do not cause a crash...
Thank you for thorough analyzis. I belive SetConsoleCtrlHandler is
a better solution since current behaviour will be preserved. Just
prepare a patch and push it to the maintainers (i don't think the
situation is reproducible under WINE, so can't make one myself).
You can also send the patch to me and i will incorporate it into
17j_audio (or whatever), so all the pending audio changes could be
merged in one go.
--
mailto:[EMAIL PROTECTED]
_______________________________________________
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel