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, szEllipses);
strcpyW(sPath+3, buff); strcpyW(sPath+3, buff);
} }
if (hdc) bRet = TRUE;
ReleaseDC(0, hdc); goto end;
return TRUE;
} }
strcpyW(lpszPath, szEllipses); strcpyW(lpszPath, szEllipses);
strcpyW(lpszPath+3, buff); strcpyW(lpszPath+3, buff);
return FALSE; bRet = FALSE;
goto end;
} }
/* Trim the path by adding ellipses to the end, e.g: /* 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) if (hdc)
ReleaseDC(0, 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 ) HBRUSH hbr, UINT flags )
{ {
CURSORICONINFO *ptr = (CURSORICONINFO *)GlobalLock16(HICON_16(hIcon)); CURSORICONINFO *ptr = (CURSORICONINFO *)GlobalLock16(HICON_16(hIcon));
HDC hDC_off = 0, hMemDC = CreateCompatibleDC (hdc); HDC hDC_off = 0, hMemDC;
BOOL result = FALSE, DoOffscreen; BOOL result = FALSE, DoOffscreen;
HBITMAP hB_off = 0, hOld = 0; 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 hdc,x0,y0,hIcon,cxWidth,cyWidth,istep,hbr,flags
); );
hMemDC = CreateCompatibleDC (hdc);
if (istep) if (istep)
FIXME_(icon)("Ignoring istep=%d\n", istep); FIXME_(icon)("Ignoring istep=%d\n", istep);
if (flags & DI_COMPAT) 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) BOOL NC_DrawGrayButton(HDC hdc, int x, int y)
{ {
HBITMAP hMaskBmp; HBITMAP hMaskBmp;
HDC hdcMask = CreateCompatibleDC (0); HDC hdcMask;
HBRUSH hOldBrush; HBRUSH hOldBrush;
hMaskBmp = CreateBitmap (12, 10, 1, 1, lpGrayMask); hMaskBmp = CreateBitmap (12, 10, 1, 1, lpGrayMask);
@ -2216,6 +2216,7 @@ BOOL NC_DrawGrayButton(HDC hdc, int x, int y)
if(hMaskBmp == 0) if(hMaskBmp == 0)
return FALSE; return FALSE;
hdcMask = CreateCompatibleDC (0);
SelectObject (hdcMask, hMaskBmp); SelectObject (hdcMask, hMaskBmp);
/* Draw the grayed bitmap using the mask */ /* Draw the grayed bitmap using the mask */