qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Qemu-devel] dsound and crash (2)


From: ZIGLIO, Frediano, VF-IT
Subject: RE: [Qemu-devel] dsound and crash (2)
Date: Mon, 5 Jun 2006 16:44:14 +0200

> > 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.
> 

Here you are. I update a bit initializazion position and exit code but
mainly is the same.

freddy77

Attachment: close.diff
Description: close.diff


reply via email to

[Prev in Thread] Current Thread [Next in Thread]