Commit in reactos/subsys/csrss on MAIN
api/process.c+2-11.36 -> 1.37
win32csr/conio.c+3-11.17 -> 1.18
        /guiconsole.c+10-11.24 -> 1.25
+15-3
3 modified files
Handle failures better (i.e. without crashing)

reactos/subsys/csrss/api
process.c 1.36 -> 1.37
diff -u -r1.36 -r1.37
--- process.c	14 Nov 2004 18:47:10 -0000	1.36
+++ process.c	18 Dec 2004 19:23:05 -0000	1.37
@@ -1,4 +1,4 @@
-/* $Id: process.c,v 1.36 2004/11/14 18:47:10 hbirr Exp $
+/* $Id: process.c,v 1.37 2004/12/18 19:23:05 gvg Exp $
  *
  * reactos/subsys/csrss/api/process.c
  *
@@ -204,6 +204,7 @@
         Reply->Status = ApiReply.Status;
         if (! NT_SUCCESS(Reply->Status))
           {
+            CsrFreeProcessData(Request->Data.CreateProcessRequest.NewProcessId);
             return Reply->Status;
           }
         Reply->Data.CreateProcessReply.InputHandle = ApiReply.Data.AllocConsoleReply.InputHandle;

reactos/subsys/csrss/win32csr
conio.c 1.17 -> 1.18
diff -u -r1.17 -r1.18
--- conio.c	14 Nov 2004 18:47:10 -0000	1.17
+++ conio.c	18 Dec 2004 19:23:05 -0000	1.18
@@ -1,4 +1,4 @@
-/* $Id: conio.c,v 1.17 2004/11/14 18:47:10 hbirr Exp $
+/* $Id: conio.c,v 1.18 2004/12/18 19:23:05 gvg Exp $
  *
  * reactos/subsys/csrss/win32csr/conio.c
  *
@@ -219,6 +219,7 @@
   NewBuffer = HeapAlloc(Win32CsrApiHeap, 0, sizeof(CSRSS_SCREEN_BUFFER));
   if (NULL == NewBuffer)
     {
+      ConioCleanupConsole(Console);
       RtlFreeUnicodeString(&Console->Title);
       RtlDeleteCriticalSection(&Console->Header.Lock);
       CloseHandle(Console->ActiveEvent);
@@ -227,6 +228,7 @@
   Status = CsrInitConsoleScreenBuffer(Console, NewBuffer);
   if (! NT_SUCCESS(Status))
     {
+      ConioCleanupConsole(Console);
       RtlFreeUnicodeString(&Console->Title);
       RtlDeleteCriticalSection(&Console->Header.Lock);
       CloseHandle(Console->ActiveEvent);

reactos/subsys/csrss/win32csr
guiconsole.c 1.24 -> 1.25
diff -u -r1.24 -r1.25
--- guiconsole.c	5 Dec 2004 01:13:29 -0000	1.24
+++ guiconsole.c	18 Dec 2004 19:23:05 -0000	1.25
@@ -1,4 +1,4 @@
-/* $Id: guiconsole.c,v 1.24 2004/12/05 01:13:29 navaraf Exp $
+/* $Id: guiconsole.c,v 1.25 2004/12/18 19:23:05 gvg Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS system libraries
@@ -793,6 +793,7 @@
 {
   HWND NewWindow;
   LONG WindowCount;
+  MSG Msg;
   PCSRSS_CONSOLE Console = (PCSRSS_CONSOLE) lParam;
 
   switch(msg)
@@ -820,6 +821,14 @@
           }
         return (LRESULT) NewWindow;
       case PM_DESTROY_CONSOLE:
+        /* Window creation is done using a PostMessage(), so it's possible that the
+         * window that we want to destroy doesn't exist yet. So first empty the message
+         * queue */
+        while(PeekMessageW(&Msg, NULL, 0, 0, PM_REMOVE))
+          {
+            TranslateMessage(&Msg);
+            DispatchMessageW(&Msg);
+          }
         DestroyWindow(Console->hWindow);
         Console->hWindow = NULL;
         WindowCount = GetWindowLongW(hWnd, GWL_USERDATA);
CVSspam 0.2.8