[COMCTL32] -ImageList: Don't leak the DC returned by saturate_image.

svn path=/trunk/; revision=74440
This commit is contained in:
Giannis Adamopoulos 2017-05-01 13:40:57 +00:00
parent 3b40688aba
commit 4bc905e4fd

View file

@ -1444,6 +1444,9 @@ ImageList_DrawIndirect (IMAGELISTDRAWPARAMS *pimldp)
HBRUSH hOldBrush; HBRUSH hOldBrush;
POINT pt; POINT pt;
BOOL has_alpha; BOOL has_alpha;
#ifdef __REACTOS__
HDC hdcSaturated;
#endif
if (!pimldp || !(himl = pimldp->himl)) return FALSE; if (!pimldp || !(himl = pimldp->himl)) return FALSE;
if (!is_valid(himl)) return FALSE; if (!is_valid(himl)) return FALSE;
@ -1500,9 +1503,10 @@ ImageList_DrawIndirect (IMAGELISTDRAWPARAMS *pimldp)
*/ */
if (fState & ILS_SATURATE) if (fState & ILS_SATURATE)
{ {
hImageListDC = saturate_image(himl, pimldp->hdcDst, pimldp->x, pimldp->y, hdcSaturated = saturate_image(himl, pimldp->hdcDst, pimldp->x, pimldp->y,
pt.x, pt.y, cx, cy, pimldp->rgbFg); pt.x, pt.y, cx, cy, pimldp->rgbFg);
hImageListDC = hdcSaturated;
/* shitty way of getting subroutines to blit at the right place (top left corner), /* shitty way of getting subroutines to blit at the right place (top left corner),
as our modified imagelist only contains a single image for performance reasons */ as our modified imagelist only contains a single image for performance reasons */
pt.x = 0; pt.x = 0;
@ -1672,6 +1676,10 @@ end:
SetTextColor(hImageDC, oldImageFg); SetTextColor(hImageDC, oldImageFg);
SelectObject(hImageDC, hOldImageBmp); SelectObject(hImageDC, hOldImageBmp);
cleanup: cleanup:
#ifdef __REACTOS__
if (hdcSaturated)
DeleteDC(hdcSaturated);
#endif
DeleteObject(hBlendMaskBmp); DeleteObject(hBlendMaskBmp);
DeleteObject(hImageBmp); DeleteObject(hImageBmp);
DeleteDC(hImageDC); DeleteDC(hImageDC);