From 1e284d22a418a42514f6b2ff31ac4a2d1d422f57 Mon Sep 17 00:00:00 2001 From: Ged Murphy Date: Mon, 17 Dec 2007 16:31:10 +0000 Subject: [PATCH] - Don't leak bitmaps in the CopyIcon call. - Pass the call on, don't call straight into win32k svn path=/trunk/; revision=31291 --- reactos/dll/win32/user32/windows/icon.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/reactos/dll/win32/user32/windows/icon.c b/reactos/dll/win32/user32/windows/icon.c index 7d24e3d162e..173aa8aa0ff 100644 --- a/reactos/dll/win32/user32/windows/icon.c +++ b/reactos/dll/win32/user32/windows/icon.c @@ -35,6 +35,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(user32); /* FUNCTIONS *****************************************************************/ + HICON ICON_CreateIconFromData(HDC hDC, PVOID ImageData, ICONIMAGE* IconImage, int cxDesired, int cyDesired, int xHotspot, int yHotspot) { @@ -147,16 +148,19 @@ ICON_CreateCursorFromData(HDC hDC, PVOID ImageData, ICONIMAGE* IconImage, int cx */ HICON STDCALL -CopyIcon( - HICON hIcon) +CopyIcon(HICON hIcon) { - ICONINFO IconInfo; + HICON hRetIcon = NULL; + ICONINFO IconInfo; - if(GetIconInfo((HANDLE)hIcon, &IconInfo)) - { - return NtUserCreateCursorIconHandle(&IconInfo, FALSE); - } - return (HICON)0; + if(GetIconInfo(hIcon, &IconInfo)) + { + hRetIcon = CreateIconIndirect(&IconInfo); + DeleteObject(IconInfo.hbmColor); + DeleteObject(IconInfo.hbmMask); + } + + return hRetIcon; }