[ros-diffs] [jimtabor] 33841: Attempt to fix bugs 3050 and 3209. DCE list becomes corrupted during shutdown.

jimtabor at svn.reactos.org jimtabor at svn.reactos.org
Tue Jun 3 23:13:11 CEST 2008


Author: jimtabor
Date: Tue Jun  3 16:13:10 2008
New Revision: 33841

URL: http://svn.reactos.org/svn/reactos?rev=33841&view=rev
Log:
Attempt to fix bugs 3050 and 3209. DCE list becomes corrupted during shutdown.

Modified:
    trunk/reactos/subsystems/win32/win32k/ntuser/windc.c

Modified: trunk/reactos/subsystems/win32/win32k/ntuser/windc.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/windc.c?rev=33841&r1=33840&r2=33841&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/windc.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/windc.c [iso-8859-1] Tue Jun  3 16:13:10 2008
@@ -575,6 +575,7 @@
 {
   DCE *ret;
   BOOL Hit = FALSE;
+  NTSTATUS Status = STATUS_SUCCESS;
 
   if (NULL == pdce) return NULL;
 
@@ -603,8 +604,23 @@
   {
       NtGdiDeleteObject(pdce->hClipRgn);
   }
-
-  RemoveEntryList(&pdce->List);
+  // Temp fix until we know where the problem is, most likely in windc.
+  _SEH_TRY
+  {            
+      RemoveEntryList(&pdce->List);
+  }
+  _SEH_HANDLE
+  {
+      Status = _SEH_GetExceptionCode();
+  }
+  _SEH_END
+  if (!NT_SUCCESS(Status))
+  {
+     SetLastNtError(Status);
+     DPRINT1("CRASHED DCE! -> %x\n" , pdce);
+     return 0; // Give it up and bail~!
+  }
+
   ExFreePoolWithTag(pdce, TAG_PDCE);
 
   return ret;
@@ -677,10 +693,16 @@
 VOID FASTCALL
 DceEmptyCache()
 {
-   while (FirstDce != NULL)
-   {
-      FirstDce = DceFreeDCE(FirstDce, TRUE);
-   }
+   PDCE pDCE = FirstDce;
+   KeEnterCriticalRegion();
+   do
+   {
+      if(!pDCE) break;
+      pDCE = DceFreeDCE(pDCE, TRUE);
+      if(!pDCE) break;
+   } while (pDCE != FirstDce);
+   KeLeaveCriticalRegion();
+   FirstDce = NULL;
 }
 
 VOID FASTCALL



More information about the Ros-diffs mailing list