user32: Add an is_shared member to cursoricon_object.
It makes sure that shared icon/cursor created by CreateIconFromResourceEx() won't be destroyed by Destroy{Icon,Cursor}(). Signed-off-by: Ziqing Hui <zhui@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
1746ed9c7d
commit
9e74b207cf
|
@ -76,6 +76,7 @@ struct cursoricon_object
|
|||
HMODULE module; /* module for icons loaded from resources */
|
||||
LPWSTR resname; /* resource name for icons loaded from resources */
|
||||
HRSRC rsrc; /* resource for shared icons */
|
||||
BOOL is_shared; /* whether this object is shared */
|
||||
BOOL is_icon; /* whether icon or cursor */
|
||||
BOOL is_ani; /* whether this object is a static cursor or an animated cursor */
|
||||
UINT delay; /* delay between this frame and the next (in jiffies) */
|
||||
|
@ -1224,10 +1225,14 @@ done:
|
|||
}
|
||||
else info->resname = MAKEINTRESOURCEW( LOWORD(resname) );
|
||||
|
||||
if (module && (cFlag & LR_SHARED))
|
||||
if (cFlag & LR_SHARED)
|
||||
{
|
||||
info->rsrc = rsrc;
|
||||
list_add_head( &icon_cache, &info->entry );
|
||||
info->is_shared = TRUE;
|
||||
if (module)
|
||||
{
|
||||
info->rsrc = rsrc;
|
||||
list_add_head( &icon_cache, &info->entry );
|
||||
}
|
||||
}
|
||||
release_user_handle_ptr( info );
|
||||
}
|
||||
|
@ -1871,7 +1876,7 @@ BOOL WINAPI DestroyIcon( HICON hIcon )
|
|||
|
||||
if (obj)
|
||||
{
|
||||
BOOL shared = (obj->rsrc != NULL);
|
||||
BOOL shared = obj->is_shared;
|
||||
release_user_handle_ptr( obj );
|
||||
ret = (NtUserGetCursor() != hIcon);
|
||||
if (!shared) free_icon_handle( hIcon );
|
||||
|
|
|
@ -1709,7 +1709,6 @@ static void test_CreateIconFromResource(void)
|
|||
ret = DestroyIcon(handle);
|
||||
ok(ret, "Destroy icon failed, error %u.\n", GetLastError());
|
||||
ret = GetIconInfo(handle, &icon_info);
|
||||
todo_wine
|
||||
ok(ret, "Get info failed, error %u.\n", GetLastError());
|
||||
|
||||
/* Test creating a shared icon from heap bits that has been created before. */
|
||||
|
@ -1747,7 +1746,6 @@ static void test_CreateIconFromResource(void)
|
|||
ret = DestroyIcon(handle);
|
||||
ok(ret, "Destroy icon failed, error %u.\n", GetLastError());
|
||||
ret = GetIconInfo(handle, &icon_info);
|
||||
todo_wine
|
||||
ok(ret, "Get info failed, error %u.\n", GetLastError());
|
||||
|
||||
/* Test creating a shared icon from resource bits that has been created before. */
|
||||
|
|
Loading…
Reference in New Issue