Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
e05e99d7
Commit
e05e99d7
authored
Jun 03, 2015
by
Sebastian Lackner
Committed by
Alexandre Julliard
Jun 04, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
server: Fix opening clipboard from multiple threads.
parent
9244cac3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
2 deletions
+17
-2
clipboard.c
dlls/user32/tests/clipboard.c
+16
-1
clipboard.c
server/clipboard.c
+1
-1
No files found.
dlls/user32/tests/clipboard.c
View file @
e05e99d7
...
@@ -24,9 +24,18 @@
...
@@ -24,9 +24,18 @@
#include "wingdi.h"
#include "wingdi.h"
#include "winuser.h"
#include "winuser.h"
static
DWORD
WINAPI
open_clipboard_thread
(
LPVOID
arg
)
{
HWND
hWnd
=
arg
;
ok
(
OpenClipboard
(
hWnd
),
"OpenClipboard failed
\n
"
);
return
0
;
}
static
void
test_ClipboardOwner
(
void
)
static
void
test_ClipboardOwner
(
void
)
{
{
HANDLE
thread
;
HWND
hWnd1
,
hWnd2
;
HWND
hWnd1
,
hWnd2
;
DWORD
dwret
;
BOOL
ret
;
BOOL
ret
;
SetLastError
(
0xdeadbeef
);
SetLastError
(
0xdeadbeef
);
...
@@ -56,7 +65,13 @@ static void test_ClipboardOwner(void)
...
@@ -56,7 +65,13 @@ static void test_ClipboardOwner(void)
ok
(
ret
,
"CloseClipboard error %d
\n
"
,
GetLastError
());
ok
(
ret
,
"CloseClipboard error %d
\n
"
,
GetLastError
());
ok
(
OpenClipboard
(
hWnd1
),
"OpenClipboard failed
\n
"
);
ok
(
OpenClipboard
(
hWnd1
),
"OpenClipboard failed
\n
"
);
ok
(
OpenClipboard
(
hWnd1
),
"OpenClipboard second time in the same hwnd failed
\n
"
);
thread
=
CreateThread
(
NULL
,
0
,
open_clipboard_thread
,
hWnd1
,
0
,
NULL
);
ok
(
thread
!=
NULL
,
"CreateThread failed with error %d
\n
"
,
GetLastError
());
dwret
=
WaitForSingleObject
(
thread
,
1000
);
ok
(
dwret
==
WAIT_OBJECT_0
,
"expected WAIT_OBJECT_0, got %u
\n
"
,
dwret
);
CloseHandle
(
thread
);
ok
(
!
CloseClipboard
(),
"CloseClipboard should fail if clipboard wasn't open
\n
"
);
ok
(
OpenClipboard
(
hWnd1
),
"OpenClipboard failed
\n
"
);
SetLastError
(
0xdeadbeef
);
SetLastError
(
0xdeadbeef
);
ret
=
OpenClipboard
(
hWnd2
);
ret
=
OpenClipboard
(
hWnd2
);
...
...
server/clipboard.c
View file @
e05e99d7
...
@@ -138,7 +138,7 @@ void cleanup_clipboard_thread(struct thread *thread)
...
@@ -138,7 +138,7 @@ void cleanup_clipboard_thread(struct thread *thread)
static
int
open_clipboard
(
struct
clipboard
*
clipboard
,
user_handle_t
win
)
static
int
open_clipboard
(
struct
clipboard
*
clipboard
,
user_handle_t
win
)
{
{
win
=
get_user_full_handle
(
win
);
win
=
get_user_full_handle
(
win
);
if
(
clipboard
->
open_thread
&&
(
clipboard
->
open_thread
!=
current
||
clipboard
->
open_win
!=
win
)
)
if
(
clipboard
->
open_thread
&&
clipboard
->
open_win
!=
win
)
{
{
set_error
(
STATUS_WAS_LOCKED
);
set_error
(
STATUS_WAS_LOCKED
);
return
0
;
return
0
;
...
...
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