Browse Source

* check writeconsoleinput and only wait for back data if write was succesful
otherwise it hangs if input is closed. Mantis #32096, analysis by jamie philbrook

git-svn-id: trunk@36663 -

marco 8 years ago
parent
commit
bf0a4e9ad7
1 changed files with 3 additions and 2 deletions
  1. 3 2
      packages/rtl-console/src/win/winevent.pp

+ 3 - 2
packages/rtl-console/src/win/winevent.pp

@@ -203,9 +203,10 @@ interface
               { mouse event can be disabled by mouse.inc code
                 in DoneMouse
                 so use a key event instead PM }
-              WriteConsoleInput(StdInputHandle,ir,1,written);
+              { 20170707 mantis #32096, only wait if really written}
+              if WriteConsoleInput(StdInputHandle,ir,1,written) then
               { wait, til the thread is ready }
-              WaitForSingleObject(EventThreadHandle,INFINITE);
+                WaitForSingleObject(EventThreadHandle,INFINITE);
               CloseHandle(EventThreadHandle);
            end;
       end;