From 902d0f0826805e8c4e77b58a1798d99ee57fee39 Mon Sep 17 00:00:00 2001 From: Royce Mitchell III Date: Tue, 7 Dec 2004 19:53:44 +0000 Subject: [PATCH] removed an ASSERT that occured when system ran out of GDI handles, and added more correct error handling for the condition svn path=/trunk/; revision=11974 --- reactos/subsys/win32k/objects/cliprgn.c | 11 ++++++++--- reactos/subsys/win32k/objects/dc.c | 17 +++++++++++++---- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/reactos/subsys/win32k/objects/cliprgn.c b/reactos/subsys/win32k/objects/cliprgn.c index 81b29f9d8c2..d86fa9c0465 100644 --- a/reactos/subsys/win32k/objects/cliprgn.c +++ b/reactos/subsys/win32k/objects/cliprgn.c @@ -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: cliprgn.c,v 1.42 2004/07/14 20:48:58 navaraf Exp $ */ +/* $Id: cliprgn.c,v 1.43 2004/12/07 19:53:44 royce Exp $ */ #include int FASTCALL @@ -43,9 +43,13 @@ CLIPPING_UpdateGCRegion(DC* Dc) CombinedRegion->rdh.nCount, (PRECTL)CombinedRegion->Buffer, (PRECTL)&CombinedRegion->rdh.rcBound); - ASSERT(Dc->CombinedClip != NULL); RGNDATA_UnlockRgn(Dc->w.hGCClipRgn); + if ( NULL == Dc->CombinedClip ) + { + DPRINT1("IntEngCreateClipRegion() failed\n"); + return ERROR; + } return NtGdiOffsetRgn(Dc->w.hGCClipRgn, -Dc->w.DCOrgX, -Dc->w.DCOrgY); } @@ -99,7 +103,8 @@ NtGdiSelectVisRgn(HDC hdc, HRGN hrgn) } retval = NtGdiCombineRgn(dc->w.hVisRgn, hrgn, 0, RGN_COPY); - CLIPPING_UpdateGCRegion(dc); + if ( retval != ERROR ) + retval = CLIPPING_UpdateGCRegion(dc); DC_UnlockDc( hdc ); return retval; diff --git a/reactos/subsys/win32k/objects/dc.c b/reactos/subsys/win32k/objects/dc.c index bccd3d1f164..79261acd300 100644 --- a/reactos/subsys/win32k/objects/dc.c +++ b/reactos/subsys/win32k/objects/dc.c @@ -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: dc.c,v 1.147 2004/11/16 16:27:49 blight Exp $ +/* $Id: dc.c,v 1.148 2004/12/07 19:53:44 royce Exp $ * * DC.C - Device context functions * @@ -1223,7 +1223,11 @@ NtGdiSetDCState ( HDC hDC, HDC hDCSave ) dc->w.hClipRgn = 0; } - CLIPPING_UpdateGCRegion( dc ); + { + int res; + res = CLIPPING_UpdateGCRegion( dc ); + ASSERT ( res != ERROR ); + } DC_UnlockDc ( hDC ); #else DC_UnlockDc ( hDC ); @@ -2022,8 +2026,13 @@ DC_InitDC(HDC DCHandle) NtGdiSelectObject(DCHandle, NtGdiGetStockObject( BLACK_PEN )); //NtGdiSelectObject(DCHandle, hFont); -// CLIPPING_UpdateGCRegion(DCToInit); - +/* + { + int res; + res = CLIPPING_UpdateGCRegion(DCToInit); + ASSERT ( res != ERROR ); + } +*/ } VOID FASTCALL