Commit 9e74b207 authored by Ziqing Hui's avatar Ziqing Hui Committed by Alexandre Julliard

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: 's avatarZiqing Hui <zhui@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 1746ed9c
......@@ -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. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment