Kirill K. Smirnov : kernel32: Invalidate local copy of console input event handle while reallocating console .

Alexandre Julliard julliard at winehq.org
Fri Dec 21 07:28:33 CST 2007


Module: wine
Branch: master
Commit: b7f617c916a210ac9d5a922809afb1ca75f4e1cd
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=b7f617c916a210ac9d5a922809afb1ca75f4e1cd

Author: Kirill K. Smirnov <lich at math.spbu.ru>
Date:   Thu Dec 20 15:19:10 2007 +0300

kernel32: Invalidate local copy of console input event handle while reallocating console.

---

 dlls/kernel32/console.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/dlls/kernel32/console.c b/dlls/kernel32/console.c
index 6bbffac..446e882 100644
--- a/dlls/kernel32/console.c
+++ b/dlls/kernel32/console.c
@@ -67,6 +67,9 @@ static CRITICAL_SECTION CONSOLE_CritSect = { &critsect_debug, -1, 0, 0, 0, 0 };
 static const WCHAR coninW[] = {'C','O','N','I','N','$',0};
 static const WCHAR conoutW[] = {'C','O','N','O','U','T','$',0};
 
+/* FIXME: this is not thread safe */
+static HANDLE console_wait_event;
+
 /* map input records to ASCII */
 static void input_records_WtoA( INPUT_RECORD *buffer, int count )
 {
@@ -378,9 +381,6 @@ BOOL WINAPI CloseConsoleHandle(HANDLE handle)
  */
 HANDLE WINAPI GetConsoleInputWaitHandle(void)
 {
-    static HANDLE console_wait_event;
- 
-    /* FIXME: this is not thread safe */
     if (!console_wait_event)
     {
         SERVER_START_REQ(get_console_wait_event)
@@ -1131,6 +1131,9 @@ BOOL WINAPI FreeConsole(VOID)
 {
     BOOL ret;
 
+    /* invalidate local copy of input event handle */
+    console_wait_event = 0;
+
     SERVER_START_REQ(free_console)
     {
         ret = !wine_server_call_err( req );
@@ -1230,6 +1233,9 @@ BOOL WINAPI AllocConsole(void)
     /* happens when we're running on a Unix console */
     if (handle_in != INVALID_HANDLE_VALUE) CloseHandle(handle_in);
 
+    /* invalidate local copy of input event handle */
+    console_wait_event = 0;
+
     GetStartupInfoA(&siCurrent);
 
     memset(&siConsole, 0, sizeof(siConsole));




More information about the wine-cvs mailing list