From 7aa6c115ead9a6015aad62ddf9a71f4dac5ca8d5 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Mon, 23 Aug 2010 01:39:28 +0000 Subject: [PATCH] [WIN32K] Move the allocation of the vis region of the DC to a later position, so that all mandatory fields are initialized before we try to delete the DC in failure case. Fixes yet another possible crash. svn path=/trunk/; revision=48604 --- .../subsystems/win32/win32k/objects/dclife.c | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/reactos/subsystems/win32/win32k/objects/dclife.c b/reactos/subsystems/win32/win32k/objects/dclife.c index 8e7e223900d..0dffdd41193 100644 --- a/reactos/subsystems/win32/win32k/objects/dclife.c +++ b/reactos/subsystems/win32/win32k/objects/dclife.c @@ -49,18 +49,6 @@ DC_AllocDC(PUNICODE_STRING Driver) hDC = NewDC->BaseObject.hHmgr; - /* Allocate a Vis region */ - NewDC->prgnVis = IntSysCreateRectpRgn(0, 0, 1, 1); - if (!NewDC->prgnVis) - { - DPRINT1("IntSysCreateRectpRgn failed\n"); - if (!GDIOBJ_FreeObjByHandle(hDC, GDI_OBJECT_TYPE_DC)) - { - ASSERT(FALSE); - } - return NULL; - } - NewDC->pdcattr = &NewDC->dcattr; DC_AllocateDcAttr(hDC); @@ -146,6 +134,18 @@ DC_AllocDC(PUNICODE_STRING Driver) hsurf = (HBITMAP)PrimarySurface.pSurface; // <- what kind of haxx0ry is that? NewDC->dclevel.pSurface = SURFACE_ShareLockSurface(hsurf); + /* Allocate a Vis region */ + NewDC->prgnVis = IntSysCreateRectpRgn(0, 0, 1, 1); + if (!NewDC->prgnVis) + { + DPRINT1("IntSysCreateRectpRgn failed\n"); + if (!GDIOBJ_FreeObjByHandle(hDC, GDI_OBJECT_TYPE_DC)) + { + ASSERT(FALSE); + } + return NULL; + } + return NewDC; }