I analyzed the dsound problem (using Windows dsound audio driver cause
crash when closing console window cf "Qemu impressions"). The problem is
very complicated. Is seems that for some reasons dsound dll is unloaded
before msvcrt (which hold atexit and exit function) so dsound free
memory then msvcrt calls at exit callbacks which try to access freed
structure... The problem occur on Windows XP and I got error using Qemu
downloaded at http://www.h7.dion.ne.jp/~qemu-win/ and compiling 0.8.1
from sources. dsound.dll is loaded calling CoCreateInstance in
audio/dsoundaudio.c (line 975) however is very strange this dll free
cause even dsound.dll depends on msvcrt.dll. Perhaps a workaround can be
to call SetConsoleCtrlHandler on main and calling exit by our own... I
noted that for some reason qemu.exe seems to load msvcrt.dll two
times...

This is a possible workaround

diff -ru qemu-0.8.1.orig/vl.c qemu-0.8.1/vl.c
--- qemu-0.8.1.orig/vl.c        Wed May  3 13:32:58 2006
+++ qemu-0.8.1/vl.c     Tue May 30 14:39:45 2006
@@ -5034,6 +5034,14 @@
 }
 #endif
 
+#ifdef _WIN32
+static BOOL WINAPI qemu_ctrl_handler(DWORD type)
+{
+    exit(1);
+    return TRUE;
+}
+#endif
+
 #define MAX_NET_CLIENTS 32
 
 int main(int argc, char **argv)
@@ -5726,6 +5734,9 @@
             vm_start();
         }
     }
+#ifdef _WIN32
+    SetConsoleCtrlHandler(qemu_ctrl_handler, TRUE);
+#endif
     main_loop();
     quit_timers();
     return 0;

freddy77



_______________________________________________
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel

Reply via email to