Fix a few GDI memory leaks.

This commit is contained in:
Mike McCormack 2002-11-13 19:43:53 +00:00 committed by Alexandre Julliard
parent 947a74f40d
commit 2d106a5706
3 changed files with 9 additions and 6 deletions

View File

@ -2773,13 +2773,13 @@ BOOL WINAPI PathCompactPathW(HDC hDC, LPWSTR lpszPath, UINT dx)
strcpyW(sPath, szEllipses);
strcpyW(sPath+3, buff);
}
if (hdc)
ReleaseDC(0, hdc);
return TRUE;
bRet = TRUE;
goto end;
}
strcpyW(lpszPath, szEllipses);
strcpyW(lpszPath+3, buff);
return FALSE;
bRet = FALSE;
goto end;
}
/* Trim the path by adding ellipses to the end, e.g:
@ -2819,6 +2819,7 @@ BOOL WINAPI PathCompactPathW(HDC hDC, LPWSTR lpszPath, UINT dx)
}
}
end:
if (hdc)
ReleaseDC(0, hdc);

View File

@ -1725,7 +1725,7 @@ BOOL WINAPI DrawIconEx( HDC hdc, INT x0, INT y0, HICON hIcon,
HBRUSH hbr, UINT flags )
{
CURSORICONINFO *ptr = (CURSORICONINFO *)GlobalLock16(HICON_16(hIcon));
HDC hDC_off = 0, hMemDC = CreateCompatibleDC (hdc);
HDC hDC_off = 0, hMemDC;
BOOL result = FALSE, DoOffscreen;
HBITMAP hB_off = 0, hOld = 0;
@ -1734,6 +1734,7 @@ BOOL WINAPI DrawIconEx( HDC hdc, INT x0, INT y0, HICON hIcon,
hdc,x0,y0,hIcon,cxWidth,cyWidth,istep,hbr,flags
);
hMemDC = CreateCompatibleDC (hdc);
if (istep)
FIXME_(icon)("Ignoring istep=%d\n", istep);
if (flags & DI_COMPAT)

View File

@ -2208,7 +2208,7 @@ LONG NC_HandleSysCommand( HWND hwnd, WPARAM wParam, LPARAM lParam )
BOOL NC_DrawGrayButton(HDC hdc, int x, int y)
{
HBITMAP hMaskBmp;
HDC hdcMask = CreateCompatibleDC (0);
HDC hdcMask;
HBRUSH hOldBrush;
hMaskBmp = CreateBitmap (12, 10, 1, 1, lpGrayMask);
@ -2216,6 +2216,7 @@ BOOL NC_DrawGrayButton(HDC hdc, int x, int y)
if(hMaskBmp == 0)
return FALSE;
hdcMask = CreateCompatibleDC (0);
SelectObject (hdcMask, hMaskBmp);
/* Draw the grayed bitmap using the mask */