[PATCH 1/2] user32: Release the icon frame in CopyImage.
Signed-off-by: Stefan Dösinger <stefan(a)codeweavers.com> --- I first though this would fix the handle leak fixed in 2/2. Not sure if it does anything, but other code that calls get_icon_frame does the same. --- dlls/user32/cursoricon.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dlls/user32/cursoricon.c b/dlls/user32/cursoricon.c index a225303f80f..f820c10a0d8 100644 --- a/dlls/user32/cursoricon.c +++ b/dlls/user32/cursoricon.c @@ -3000,6 +3000,7 @@ HANDLE WINAPI CopyImage( HANDLE hnd, UINT type, INT desiredx, { if (!(info.hbmColor = create_color_bitmap( desiredx, desiredy ))) { + release_icon_frame( icon, frame ); release_user_handle_ptr( icon ); return 0; } @@ -3009,6 +3010,7 @@ HANDLE WINAPI CopyImage( HANDLE hnd, UINT type, INT desiredx, if (!(info.hbmMask = CreateBitmap( desiredx, desiredy, 1, 1, NULL ))) { DeleteObject( info.hbmColor ); + release_icon_frame( icon, frame ); release_user_handle_ptr( icon ); return 0; } @@ -3034,6 +3036,7 @@ HANDLE WINAPI CopyImage( HANDLE hnd, UINT type, INT desiredx, DeleteObject( info.hbmMask ); } + release_icon_frame( icon, frame ); release_user_handle_ptr( icon ); if (res && (flags & LR_COPYDELETEORG)) DeleteObject( hnd ); -- 2.31.1
Signed-off-by: Stefan Dösinger <stefan(a)codeweavers.com> --- Fixes a handle leak in explorer.exe when an application repeatedly redraws the systray icon introduced by 5df5972f9aac. GetIconInfoExW returns a copy, CopyImage does not take ownership, so we have to relese them. --- dlls/user32/cursoricon.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dlls/user32/cursoricon.c b/dlls/user32/cursoricon.c index f820c10a0d8..7ad0a04a551 100644 --- a/dlls/user32/cursoricon.c +++ b/dlls/user32/cursoricon.c @@ -1670,12 +1670,16 @@ HICON WINAPI CreateIcon( HINSTANCE instance, int width, int height, BYTE planes, HICON WINAPI CopyIcon( HICON icon ) { ICONINFOEXW info; + HICON res; info.cbSize = sizeof(info); if (!GetIconInfoExW( icon, &info )) return NULL; - return CopyImage( icon, info.fIcon ? IMAGE_ICON : IMAGE_CURSOR, 0, 0, 0 ); + res = CopyImage( icon, info.fIcon ? IMAGE_ICON : IMAGE_CURSOR, 0, 0, 0 ); + DeleteObject( info.hbmColor ); + DeleteObject( info.hbmMask ); + return res; } -- 2.31.1
Hi, While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check? Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=92225 Your paranoid android. === debiant2 (32 bit report) === user32: menu.c:2337: Test failed: test 25 === debiant2 (32 bit Chinese:China report) === user32: input.c:2222: Test failed: GetRawInputData succeeded input.c:2223: Test failed: GetRawInputData returned deadbeef input.c:2341: Test failed: Spurious WM_INPUT messages
participants (2)
-
Marvin -
Stefan Dösinger