[EXPLORER] proper fix for CID 1321923, 1321924

svn path=/trunk/; revision=68924
This commit is contained in:
Christoph von Wittich 2015-09-03 07:01:29 +00:00
parent 831d7c9721
commit 818c6c4afc

View file

@ -190,7 +190,7 @@ DefSize:
HDC hDC = NULL; HDC hDC = NULL;
HDC hDCScreen = NULL; HDC hDCScreen = NULL;
SIZE Size, SmallIcon; SIZE Size, SmallIcon;
HBITMAP hbmpOld; HBITMAP hbmpOld, hbmp = NULL;
HBITMAP hBitmap = NULL; HBITMAP hBitmap = NULL;
HICON hIconStart; HICON hIconStart;
BOOL Ret; BOOL Ret;
@ -243,10 +243,10 @@ DefSize:
Size.cy = max(Size.cy, SmallIcon.cy); Size.cy = max(Size.cy, SmallIcon.cy);
/* Create the bitmap */ /* Create the bitmap */
hBitmap = CreateCompatibleBitmap(hDCScreen, hbmp = CreateCompatibleBitmap(hDCScreen,
Size.cx, Size.cx,
Size.cy); Size.cy);
if (hBitmap == NULL) if (hbmp == NULL)
goto Cleanup; goto Cleanup;
/* Caluclate the button rect */ /* Caluclate the button rect */
@ -256,13 +256,13 @@ DefSize:
rcButton.bottom = Size.cy; rcButton.bottom = Size.cy;
/* Draw the button */ /* Draw the button */
hbmpOld = (HBITMAP) SelectObject(hDC, hBitmap); hbmpOld = (HBITMAP) SelectObject(hDC, hbmp);
Flags = DC_TEXT | DC_INBUTTON; Flags = DC_TEXT | DC_INBUTTON;
if (hIconStart != NULL) if (hIconStart != NULL)
Flags |= DC_ICON; Flags |= DC_ICON;
DrawCaptionTemp(NULL, Ret = DrawCaptionTemp(NULL,
hDC, hDC,
&rcButton, &rcButton,
m_Font, m_Font,
@ -275,12 +275,19 @@ DefSize:
if (!Ret) if (!Ret)
goto Cleanup; goto Cleanup;
/* We successfully created the bitmap! */
hBitmap = hbmp;
hbmp = NULL;
Cleanup: Cleanup:
if (hDCScreen != NULL) if (hDCScreen != NULL)
{ {
::ReleaseDC(NULL, hDCScreen); ::ReleaseDC(NULL, hDCScreen);
} }
if (hbmp != NULL)
DeleteObject(hbmp);
if (hDC != NULL) if (hDC != NULL)
DeleteDC(hDC); DeleteDC(hDC);