fix region leak

svn path=/trunk/; revision=26920
This commit is contained in:
Timo Kreuzer 2007-05-27 12:48:45 +00:00
parent b476f82321
commit 6e719efbe9

View file

@ -166,27 +166,34 @@ IntGetNCUpdateRgn(PWINDOW_OBJECT Window, BOOL Validate)
Window->UpdateRegion != (HRGN)1)
{
hRgnNonClient = NtGdiCreateRectRgn(0, 0, 0, 0);
hRgnWindow = IntCalcWindowRgn(Window, TRUE);
/*
* If region creation fails it's safe to fallback to whole
* window region.
*/
if (hRgnNonClient == NULL)
{
return (HRGN)1;
}
hRgnWindow = IntCalcWindowRgn(Window, TRUE);
if (hRgnWindow == NULL)
{
NtGdiDeleteObject(hRgnNonClient);
return (HRGN)1;
}
RgnType = NtGdiCombineRgn(hRgnNonClient, Window->UpdateRegion,
hRgnWindow, RGN_DIFF);
if (RgnType == ERROR)
{
NtGdiDeleteObject(hRgnWindow);
NtGdiDeleteObject(hRgnNonClient);
return (HRGN)1;
}
else if (RgnType == NULLREGION)
{
NtGdiDeleteObject(hRgnWindow);
NtGdiDeleteObject(hRgnNonClient);
return NULL;
}