[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 1/6] main-loop: Fix SetEvent() on uninitialized hand
From: |
Michael Roth |
Subject: |
[Qemu-devel] [PATCH 1/6] main-loop: Fix SetEvent() on uninitialized handle on win32 |
Date: |
Wed, 25 Jan 2012 09:26:21 -0600 |
The __attribute__((constructor)) init_main_loop() automatically get
called if qemu-tool.o is linked in. On win32, this leads to
a qemu_notify_event() call which attempts to SetEvent() on a HANDLE that
won't be initialized until qemu_init_main_loop() is manually called,
breaking qemu-tools.o programs on Windows at runtime.
This patch checks for an initialized event handle before attempting to
set it, which is analoguous to how we deal with an unitialized
io_thread_fd in the posix implementation.
Signed-off-by: Michael Roth <address@hidden>
---
main-loop.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/main-loop.c b/main-loop.c
index 692381c..62d95b9 100644
--- a/main-loop.c
+++ b/main-loop.c
@@ -164,7 +164,7 @@ static int qemu_signal_init(void)
#else /* _WIN32 */
-HANDLE qemu_event_handle;
+HANDLE qemu_event_handle = NULL;
static void dummy_event_handler(void *opaque)
{
@@ -183,6 +183,9 @@ static int qemu_event_init(void)
void qemu_notify_event(void)
{
+ if (!qemu_event_handle) {
+ return;
+ }
if (!SetEvent(qemu_event_handle)) {
fprintf(stderr, "qemu_notify_event: SetEvent failed: %ld\n",
GetLastError());
--
1.7.4.1
- [Qemu-devel] [PULL 0/6] qemu-ga queue and qemu-tool fixes, Michael Roth, 2012/01/25
- [Qemu-devel] [PATCH 1/6] main-loop: Fix SetEvent() on uninitialized handle on win32,
Michael Roth <=
- [Qemu-devel] [PATCH 2/6] main-loop: For tools, initialize timers as part of qemu_init_main_loop(), Michael Roth, 2012/01/25
- [Qemu-devel] [PATCH 3/6] qemu-ga: Add schema documentation for types, Michael Roth, 2012/01/25
- [Qemu-devel] [PATCH 6/6] qemu-ga: Add the guest-suspend command, Michael Roth, 2012/01/25
- [Qemu-devel] [PATCH 5/6] qemu-ga: set O_NONBLOCK for serial channels, Michael Roth, 2012/01/25
- [Qemu-devel] [PATCH 4/6] qemu-ga: add guest-set-support-level command, Michael Roth, 2012/01/25