Commit in reactos/subsys/win32k/ntuser on MAIN
painting.c+17-21.75 -> 1.76
Mark update regions as global objects, to prevent their destruction when
the creating process exits

reactos/subsys/win32k/ntuser
painting.c 1.75 -> 1.76
diff -u -r1.75 -r1.76
--- painting.c	29 Feb 2004 11:34:42 -0000	1.75
+++ painting.c	13 Mar 2004 17:33:53 -0000	1.76
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- *  $Id: painting.c,v 1.75 2004/02/29 11:34:42 navaraf Exp $
+ *  $Id: painting.c,v 1.76 2004/03/13 17:33:53 gvg Exp $
  *
  *  COPYRIGHT:        See COPYING in the top level directory
  *  PROJECT:          ReactOS kernel
@@ -113,6 +113,10 @@
               IntValidateParent(Window, Window->NCUpdateRegion);
             }
           TempRegion = Window->NCUpdateRegion;
+          if ((HANDLE) 1 != TempRegion && NULL != TempRegion)
+            {
+              GDIOBJ_SetOwnership(TempRegion, PsGetCurrentProcess());
+            }
           Window->NCUpdateRegion = NULL;
           Window->Flags &= ~WINDOWOBJECT_NEED_NCPAINT;
           MsqDecPaintCountQueue(Window->MessageQueue);
@@ -246,11 +250,13 @@
       if (Window->UpdateRegion == NULL)
       {
          Window->UpdateRegion = NtGdiCreateRectRgn(0, 0, 0, 0);
+         GDIOBJ_SetOwnership(Window->UpdateRegion, NULL);
       }
 
       if (NtGdiCombineRgn(Window->UpdateRegion, Window->UpdateRegion,
           hRgn, RGN_OR) == NULLREGION)
       {
+         GDIOBJ_SetOwnership(Window->UpdateRegion, PsGetCurrentProcess());
          NtGdiDeleteObject(Window->UpdateRegion);
          Window->UpdateRegion = NULL;
       }
@@ -270,6 +276,7 @@
          if (NtGdiCombineRgn(Window->UpdateRegion, Window->UpdateRegion,
              hRgn, RGN_DIFF) == NULLREGION)
          {
+            GDIOBJ_SetOwnership(Window->UpdateRegion, PsGetCurrentProcess());
             NtGdiDeleteObject(Window->UpdateRegion);
             Window->UpdateRegion = NULL;
          }
@@ -306,9 +313,11 @@
          -Window->WindowRect.top);
 
       hRgnNonClient = NtGdiCreateRectRgn(0, 0, 0, 0);
+      GDIOBJ_SetOwnership(hRgnNonClient, NULL);
       if (NtGdiCombineRgn(hRgnNonClient, Window->UpdateRegion,
           hRgnWindow, RGN_DIFF) == NULLREGION)
       {
+         GDIOBJ_SetOwnership(hRgnNonClient, PsGetCurrentProcess());
          NtGdiDeleteObject(hRgnNonClient);
          hRgnNonClient = NULL;
       }
@@ -320,6 +329,7 @@
       if (NtGdiCombineRgn(Window->UpdateRegion, Window->UpdateRegion,
           hRgnWindow, RGN_AND) == NULLREGION)
       {
+         GDIOBJ_SetOwnership(Window->UpdateRegion, PsGetCurrentProcess());
          NtGdiDeleteObject(Window->UpdateRegion);
          Window->UpdateRegion = NULL;
       }
@@ -332,7 +342,11 @@
       {
          NtGdiCombineRgn(Window->NCUpdateRegion, Window->NCUpdateRegion,
             hRgnNonClient, RGN_OR);
-         NtGdiDeleteObject(hRgnNonClient);
+         if (NULL != hRgnNonClient)
+         {
+            GDIOBJ_SetOwnership(hRgnNonClient, PsGetCurrentProcess());
+            NtGdiDeleteObject(hRgnNonClient);
+         }
       }
 
       NtGdiDeleteObject(hRgnWindow);
@@ -736,6 +750,7 @@
       NtGdiOffsetRect(&lPs->rcPaint,
          Window->WindowRect.left - Window->ClientRect.left,
          Window->WindowRect.top - Window->ClientRect.top);
+      GDIOBJ_SetOwnership(Window->UpdateRegion, PsGetCurrentProcess());
       NtGdiDeleteObject(Window->UpdateRegion);
       Window->UpdateRegion = NULL;
    }
CVSspam 0.2.8