Commit 3587d7e69cd25f14eccec01c547f1257171fde7b
1 parent
d796321b
fix crash when closing windows (Frediano Ziglio)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2026 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
10 additions
and
0 deletions
vl.c
@@ -5495,6 +5495,14 @@ static void select_soundhw (const char *optarg) | @@ -5495,6 +5495,14 @@ static void select_soundhw (const char *optarg) | ||
5495 | } | 5495 | } |
5496 | #endif | 5496 | #endif |
5497 | 5497 | ||
5498 | +#ifdef _WIN32 | ||
5499 | +static BOOL WINAPI qemu_ctrl_handler(DWORD type) | ||
5500 | +{ | ||
5501 | + exit(STATUS_CONTROL_C_EXIT); | ||
5502 | + return TRUE; | ||
5503 | +} | ||
5504 | +#endif | ||
5505 | + | ||
5498 | #define MAX_NET_CLIENTS 32 | 5506 | #define MAX_NET_CLIENTS 32 |
5499 | 5507 | ||
5500 | int main(int argc, char **argv) | 5508 | int main(int argc, char **argv) |
@@ -5534,6 +5542,8 @@ int main(int argc, char **argv) | @@ -5534,6 +5542,8 @@ int main(int argc, char **argv) | ||
5534 | act.sa_handler = SIG_IGN; | 5542 | act.sa_handler = SIG_IGN; |
5535 | sigaction(SIGPIPE, &act, NULL); | 5543 | sigaction(SIGPIPE, &act, NULL); |
5536 | } | 5544 | } |
5545 | +#else | ||
5546 | + SetConsoleCtrlHandler(qemu_ctrl_handler, TRUE); | ||
5537 | #endif | 5547 | #endif |
5538 | init_timers(); | 5548 | init_timers(); |
5539 | 5549 |