Author: cwittich Date: Thu Sep 3 07:01:29 2015 New Revision: 68924
URL: http://svn.reactos.org/svn/reactos?rev=68924&view=rev Log: [EXPLORER] proper fix for CID 1321923, 1321924
Modified: trunk/reactos/base/shell/explorer/traywnd.cpp
Modified: trunk/reactos/base/shell/explorer/traywnd.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/traywnd... ============================================================================== --- trunk/reactos/base/shell/explorer/traywnd.cpp [iso-8859-1] (original) +++ trunk/reactos/base/shell/explorer/traywnd.cpp [iso-8859-1] Thu Sep 3 07:01:29 2015 @@ -190,7 +190,7 @@ HDC hDC = NULL; HDC hDCScreen = NULL; SIZE Size, SmallIcon; - HBITMAP hbmpOld; + HBITMAP hbmpOld, hbmp = NULL; HBITMAP hBitmap = NULL; HICON hIconStart; BOOL Ret; @@ -243,10 +243,10 @@ Size.cy = max(Size.cy, SmallIcon.cy);
/* Create the bitmap */ - hBitmap = CreateCompatibleBitmap(hDCScreen, + hbmp = CreateCompatibleBitmap(hDCScreen, Size.cx, Size.cy); - if (hBitmap == NULL) + if (hbmp == NULL) goto Cleanup;
/* Caluclate the button rect */ @@ -256,13 +256,13 @@ rcButton.bottom = Size.cy;
/* Draw the button */ - hbmpOld = (HBITMAP) SelectObject(hDC, hBitmap); + hbmpOld = (HBITMAP) SelectObject(hDC, hbmp);
Flags = DC_TEXT | DC_INBUTTON; if (hIconStart != NULL) Flags |= DC_ICON;
- DrawCaptionTemp(NULL, + Ret = DrawCaptionTemp(NULL, hDC, &rcButton, m_Font, @@ -275,11 +275,18 @@ if (!Ret) goto Cleanup;
+ /* We successfully created the bitmap! */ + hBitmap = hbmp; + hbmp = NULL; + Cleanup: if (hDCScreen != NULL) { ::ReleaseDC(NULL, hDCScreen); } + + if (hbmp != NULL) + DeleteObject(hbmp);
if (hDC != NULL) DeleteDC(hDC);