From 99f3640c1701d74289967f9433d15699aab1c75f Mon Sep 17 00:00:00 2001 From: Thomas Bluemel Date: Sat, 19 Feb 2005 11:13:41 +0000 Subject: [PATCH] don't pass NULL handles to NtGdiCombineRgn svn path=/trunk/; revision=13640 --- reactos/subsys/win32k/ntuser/painting.c | 17 +++++++++-------- reactos/subsys/win32k/ntuser/windc.c | 17 ++++++++++++++--- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/reactos/subsys/win32k/ntuser/painting.c b/reactos/subsys/win32k/ntuser/painting.c index 9fb5e70aecd..dece285b320 100644 --- a/reactos/subsys/win32k/ntuser/painting.c +++ b/reactos/subsys/win32k/ntuser/painting.c @@ -309,19 +309,20 @@ IntInvalidateWindows(PWINDOW_OBJECT Window, HRGN hRgn, ULONG Flags) -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; } + else + { + GDIOBJ_SetOwnership(hRgnNonClient, NULL); + } /* * Remove the nonclient region from the standard update region. */ - if (NtGdiCombineRgn(Window->UpdateRegion, Window->UpdateRegion, hRgnWindow, RGN_AND) == NULLREGION) { @@ -336,12 +337,12 @@ IntInvalidateWindows(PWINDOW_OBJECT Window, HRGN hRgn, ULONG Flags) } else { - NtGdiCombineRgn(Window->NCUpdateRegion, Window->NCUpdateRegion, - hRgnNonClient, RGN_OR); - if (NULL != hRgnNonClient) + if(NULL != hRgnNonClient) { - GDIOBJ_SetOwnership(hRgnNonClient, PsGetCurrentProcess()); - NtGdiDeleteObject(hRgnNonClient); + NtGdiCombineRgn(Window->NCUpdateRegion, Window->NCUpdateRegion, + hRgnNonClient, RGN_OR); + GDIOBJ_SetOwnership(hRgnNonClient, PsGetCurrentProcess()); + NtGdiDeleteObject(hRgnNonClient); } } diff --git a/reactos/subsys/win32k/ntuser/windc.c b/reactos/subsys/win32k/ntuser/windc.c index 2d63c19b07b..7463bce6d03 100644 --- a/reactos/subsys/win32k/ntuser/windc.c +++ b/reactos/subsys/win32k/ntuser/windc.c @@ -213,7 +213,7 @@ DceDeleteClipRgn(DCE* Dce) { Dce->DCXFlags &= ~DCX_KEEPCLIPRGN; } - else if (Dce->hClipRgn > (HRGN) 1) + else if (Dce->hClipRgn != NULL) { GDIOBJ_SetOwnership(Dce->hClipRgn, PsGetCurrentProcess()); NtGdiDeleteObject(Dce->hClipRgn); @@ -332,10 +332,21 @@ DceUpdateVisRgn(DCE *Dce, PWINDOW_OBJECT Window, ULONG Flags) noparent: if (Flags & DCX_INTERSECTRGN) { - NtGdiCombineRgn(hRgnVisible, hRgnVisible, Dce->hClipRgn, RGN_AND); + if(Dce->hClipRgn != NULL) + { + NtGdiCombineRgn(hRgnVisible, hRgnVisible, Dce->hClipRgn, RGN_AND); + } + else + { + if(hRgnVisible != NULL) + { + NtGdiDeleteObject(hRgnVisible); + } + hRgnVisible = NtGdiCreateRectRgn(0, 0, 0, 0); + } } - if (Flags & DCX_EXCLUDERGN) + if (Flags & DCX_EXCLUDERGN && Dce->hClipRgn != NULL) { NtGdiCombineRgn(hRgnVisible, hRgnVisible, Dce->hClipRgn, RGN_DIFF); }