Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
e8723a5d
Commit
e8723a5d
authored
Oct 13, 2010
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32: Fix destruction of the active cursor.
parent
1aab7ea8
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
29 deletions
+25
-29
cursoricon.c
dlls/user32/cursoricon.c
+20
-24
cursoricon.c
dlls/user32/tests/cursoricon.c
+5
-5
No files found.
dlls/user32/cursoricon.c
View file @
e8723a5d
...
...
@@ -387,22 +387,6 @@ static int DIB_GetBitmapInfo( const BITMAPINFOHEADER *header, LONG *width,
}
/**********************************************************************
* is_icon_shared
*/
static
BOOL
is_icon_shared
(
HICON
handle
)
{
struct
cursoricon_object
*
info
;
BOOL
ret
=
FALSE
;
if
((
info
=
get_icon_ptr
(
handle
)))
{
ret
=
info
->
rsrc
!=
NULL
;
release_icon_ptr
(
handle
,
info
);
}
return
ret
;
}
/**********************************************************************
* get_icon_size
*/
BOOL
get_icon_size
(
HICON
handle
,
SIZE
*
size
)
...
...
@@ -1357,7 +1341,11 @@ HICON WINAPI CopyIcon( HICON hIcon )
struct
cursoricon_object
*
ptrOld
,
*
ptrNew
;
HICON
hNew
;
if
(
!
(
ptrOld
=
get_icon_ptr
(
hIcon
)))
return
0
;
if
(
!
(
ptrOld
=
get_icon_ptr
(
hIcon
)))
{
SetLastError
(
ERROR_INVALID_CURSOR_HANDLE
);
return
0
;
}
if
((
hNew
=
alloc_icon_handle
(
1
)))
{
ptrNew
=
get_icon_ptr
(
hNew
);
...
...
@@ -1381,10 +1369,19 @@ HICON WINAPI CopyIcon( HICON hIcon )
*/
BOOL
WINAPI
DestroyIcon
(
HICON
hIcon
)
{
BOOL
ret
=
FALSE
;
struct
cursoricon_object
*
obj
=
get_icon_ptr
(
hIcon
);
TRACE_
(
icon
)(
"%p
\n
"
,
hIcon
);
if
(
!
is_icon_shared
(
hIcon
))
free_icon_handle
(
hIcon
);
return
TRUE
;
if
(
obj
)
{
BOOL
shared
=
(
obj
->
rsrc
!=
NULL
);
release_icon_ptr
(
hIcon
,
obj
);
ret
=
(
GetCursor
()
!=
hIcon
);
if
(
!
shared
)
free_icon_handle
(
hIcon
);
}
return
ret
;
}
...
...
@@ -1393,11 +1390,6 @@ BOOL WINAPI DestroyIcon( HICON hIcon )
*/
BOOL
WINAPI
DestroyCursor
(
HCURSOR
hCursor
)
{
if
(
GetCursor
()
==
hCursor
)
{
WARN_
(
cursor
)(
"Destroying active cursor!
\n
"
);
return
FALSE
;
}
return
DestroyIcon
(
hCursor
);
}
...
...
@@ -1419,6 +1411,7 @@ BOOL WINAPI DrawIcon( HDC hdc, INT x, INT y, HICON hIcon )
*/
HCURSOR
WINAPI
DECLSPEC_HOTPATCH
SetCursor
(
HCURSOR
hCursor
/* [in] Handle of cursor to show */
)
{
struct
cursoricon_object
*
obj
;
HCURSOR
hOldCursor
;
int
show_count
;
BOOL
ret
;
...
...
@@ -1441,6 +1434,9 @@ HCURSOR WINAPI DECLSPEC_HOTPATCH SetCursor( HCURSOR hCursor /* [in] Handle of cu
/* Change the cursor shape only if it is visible */
if
(
show_count
>=
0
&&
hOldCursor
!=
hCursor
)
USER_Driver
->
pSetCursor
(
hCursor
);
if
(
!
(
obj
=
get_icon_ptr
(
hOldCursor
)))
return
0
;
release_icon_ptr
(
hOldCursor
,
obj
);
return
hOldCursor
;
}
...
...
dlls/user32/tests/cursoricon.c
View file @
e8723a5d
...
...
@@ -82,7 +82,7 @@ static LRESULT CALLBACK callback_child(HWND hwnd, UINT msg, WPARAM wParam, LPARA
SetLastError
(
0xdeadbeef
);
ret
=
DestroyCursor
((
HCURSOR
)
lParam
);
error
=
GetLastError
();
todo_wine
ok
(
!
ret
||
broken
(
ret
)
/* win9x */
,
"DestroyCursor on the active cursor succeeded.
\n
"
);
ok
(
!
ret
||
broken
(
ret
)
/* win9x */
,
"DestroyCursor on the active cursor succeeded.
\n
"
);
ok
(
error
==
ERROR_DESTROY_OBJECT_OF_OTHER_THREAD
||
error
==
0xdeadbeef
,
/* vista */
"Last error: %u
\n
"
,
error
);
...
...
@@ -1769,8 +1769,8 @@ static void test_DestroyCursor(void)
SetLastError
(
0xdeadbeef
);
ret
=
GetIconInfo
(
cursor
,
&
new_info
);
todo_wine
ok
(
!
ret
||
broken
(
ret
),
/* nt4 */
"GetIconInfo succeeded
\n
"
);
todo_wine
ok
(
GetLastError
()
==
ERROR_INVALID_CURSOR_HANDLE
||
ok
(
!
ret
||
broken
(
ret
),
/* nt4 */
"GetIconInfo succeeded
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_CURSOR_HANDLE
||
broken
(
GetLastError
()
==
0xdeadbeef
),
/* win9x */
"wrong error %u
\n
"
,
GetLastError
()
);
...
...
@@ -1824,7 +1824,7 @@ static void test_DestroyCursor(void)
if
(
new_cursor
!=
cursor
)
/* win9x */
ok
(
cursor2
==
new_cursor
,
"SetCursor returned %p/%p
\n
"
,
cursor2
,
cursor
);
else
todo_wine
ok
(
!
cursor2
,
"SetCursor returned %p/%p
\n
"
,
cursor2
,
cursor
);
ok
(
!
cursor2
,
"SetCursor returned %p/%p
\n
"
,
cursor2
,
cursor
);
ok
(
GetLastError
()
==
0xdeadbeef
,
"wrong error %u
\n
"
,
GetLastError
()
);
cursor2
=
GetCursor
();
...
...
@@ -1835,7 +1835,7 @@ static void test_DestroyCursor(void)
if
(
new_cursor
!=
cursor
)
/* win9x */
ok
(
ret
,
"DestroyCursor succeeded
\n
"
);
else
todo_wine
ok
(
!
ret
,
"DestroyCursor succeeded
\n
"
);
ok
(
!
ret
,
"DestroyCursor succeeded
\n
"
);
error
=
GetLastError
();
ok
(
GetLastError
()
==
ERROR_INVALID_CURSOR_HANDLE
||
GetLastError
()
==
0xdeadbeef
,
"wrong error %u
\n
"
,
GetLastError
()
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment