From d2b0c045cd15e03cbe4d555202942b95d33f63b1 Mon Sep 17 00:00:00 2001 From: Royce Mitchell III Date: Mon, 13 Dec 2004 05:23:59 +0000 Subject: [PATCH] BUGFIX: unhandled error conditions IntGdiCreateDC() svn path=/trunk/; revision=12073 --- reactos/subsys/win32k/objects/dc.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/reactos/subsys/win32k/objects/dc.c b/reactos/subsys/win32k/objects/dc.c index 6d3b4519f69..07f7f1c621b 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.152 2004/12/12 21:58:42 royce Exp $ +/* $Id: dc.c,v 1.153 2004/12/13 05:23:59 royce Exp $ * * DC.C - Device context functions * @@ -738,7 +738,11 @@ IntGdiCreateDC(PUNICODE_STRING Driver, NewDC = DC_LockDc( hNewDC ); /* FIXME - NewDC can be NULL!!! Don't assert here! */ - ASSERT( NewDC ); + if ( !NewDC ) + { + DC_FreeDC( hNewDC ); + return NULL; + } NewDC->DMW = PrimarySurface.DMW; NewDC->DevInfo = &PrimarySurface.DevInfo; @@ -757,6 +761,12 @@ IntGdiCreateDC(PUNICODE_STRING Driver, NewDC->DMW.dmLogPixels = 96; SurfObj = EngLockSurface((HSURF)PrimarySurface.Handle); + if ( !SurfObj ) + { + DC_UnlockDc ( hNewDC ); + DC_FreeDC ( hNewDC) ; + return NULL; + } NewDC->DMW.dmBitsPerPel = BitsPerFormat(SurfObj->iBitmapFormat); NewDC->DMW.dmPelsWidth = SurfObj->sizlBitmap.cx; NewDC->DMW.dmPelsHeight = SurfObj->sizlBitmap.cy; -- 2.17.1