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
This commit is contained in:
Timo Kreuzer
2010-08-23 01:39:28 +00:00
parent 35eedf6749
commit 7aa6c115ea
@@ -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;
}