mirror of
https://github.com/reactos/reactos.git
synced 2024-06-29 01:12:06 +00:00
fix region leak
svn path=/trunk/; revision=26920
This commit is contained in:
parent
b476f82321
commit
6e719efbe9
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue