From: John Sullivan jswinebz@kanargh.org.uk
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52207 Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/user32/cursoricon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/user32/cursoricon.c b/dlls/user32/cursoricon.c index 827db302a30..35f13a1a91b 100644 --- a/dlls/user32/cursoricon.c +++ b/dlls/user32/cursoricon.c @@ -3180,7 +3180,7 @@ HANDLE WINAPI CopyImage( HANDLE hnd, UINT type, INT desiredx, release_icon_frame( icon, frame ); release_user_handle_ptr( icon );
- if (res && (flags & LR_COPYDELETEORG)) DeleteObject( hnd ); + if (res && (flags & LR_COPYDELETEORG)) DestroyIcon( hnd ); return res; } }
Spotted by John Sullivan.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52207 Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/user32/cursoricon.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/dlls/user32/cursoricon.c b/dlls/user32/cursoricon.c index 35f13a1a91b..76f13a775e3 100644 --- a/dlls/user32/cursoricon.c +++ b/dlls/user32/cursoricon.c @@ -3100,6 +3100,7 @@ HANDLE WINAPI CopyImage( HANDLE hnd, UINT type, INT desiredx, struct cursoricon_frame *frame; struct cursoricon_object *icon; int depth = (flags & LR_MONOCHROME) ? 1 : get_display_bpp(); + HICON resource_icon = NULL; ICONINFO info; HICON res;
@@ -3107,10 +3108,14 @@ HANDLE WINAPI CopyImage( HANDLE hnd, UINT type, INT desiredx,
if (icon->rsrc && (flags & LR_COPYFROMRESOURCE)) { - hnd = CURSORICON_Load( icon->module, icon->resname, desiredx, desiredy, depth, - !icon->is_icon, flags ); + resource_icon = CURSORICON_Load( icon->module, icon->resname, desiredx, + desiredy, depth, !icon->is_icon, flags ); release_user_handle_ptr( icon ); - if (!(icon = get_icon_ptr( hnd ))) return 0; + if (!(icon = get_icon_ptr( resource_icon ))) + { + if (resource_icon) DestroyIcon( resource_icon ); + return 0; + } } frame = get_icon_frame( icon, 0 );
@@ -3143,6 +3148,7 @@ HANDLE WINAPI CopyImage( HANDLE hnd, UINT type, INT desiredx, { release_icon_frame( icon, frame ); release_user_handle_ptr( icon ); + if (resource_icon) DestroyIcon( resource_icon ); return 0; } stretch_bitmap( info.hbmColor, frame->color, desiredx, desiredy, @@ -3153,6 +3159,7 @@ HANDLE WINAPI CopyImage( HANDLE hnd, UINT type, INT desiredx, DeleteObject( info.hbmColor ); release_icon_frame( icon, frame ); release_user_handle_ptr( icon ); + if (resource_icon) DestroyIcon( resource_icon ); return 0; } stretch_bitmap( info.hbmMask, frame->mask, desiredx, desiredy, @@ -3165,6 +3172,7 @@ HANDLE WINAPI CopyImage( HANDLE hnd, UINT type, INT desiredx, if (!(info.hbmMask = CreateBitmap( desiredx, desiredy * 2, 1, 1, NULL ))) { release_user_handle_ptr( icon ); + if (resource_icon) DestroyIcon( resource_icon ); return 0; } stretch_bitmap( info.hbmMask, frame->mask, desiredx, desiredy * 2, @@ -3181,6 +3189,7 @@ HANDLE WINAPI CopyImage( HANDLE hnd, UINT type, INT desiredx, release_user_handle_ptr( icon );
if (res && (flags & LR_COPYDELETEORG)) DestroyIcon( hnd ); + if (resource_icon) DestroyIcon( resource_icon ); return res; } }
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=104170
Your paranoid android.
=== debian11 (64 bit WoW report) ===
user32: win.c:10433: Test failed: Expected foreground window 0, got 0000000000D400EC win.c:10439: Test failed: Expected foreground window 0000000000550126, got 0000000000D400EC win.c:10456: Test failed: Expected foreground window 0000000000550126, got 0000000000D400EC win.c:10458: Test failed: GetActiveWindow() = 0000000000000000 win.c:10458: Test failed: GetFocus() = 0000000000000000 win.c:10460: Test failed: Received WM_ACTIVATEAPP(0), did not expect it. win.c:10468: Test failed: Expected foreground window 0000000000550126, got 0000000000000000 win.c:10470: Test failed: GetActiveWindow() = 0000000000000000 win.c:10470: Test failed: GetFocus() = 0000000000000000 win.c:10478: Test failed: Received WM_ACTIVATEAPP(1), did not expect it.