server: Don't release the clipboard owner window when the owner thread terminates.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2016-09-01 22:13:53 +09:00
parent bddab0e7f8
commit 2b8021d4d0
2 changed files with 19 additions and 1 deletions

View File

@ -57,6 +57,14 @@ static DWORD WINAPI open_and_empty_clipboard_thread(LPVOID arg)
return 0;
}
static DWORD WINAPI open_and_empty_clipboard_win_thread(LPVOID arg)
{
HWND hwnd = CreateWindowA( "static", NULL, WS_POPUP, 0, 0, 10, 10, 0, 0, 0, NULL );
ok(OpenClipboard(hwnd), "%u: OpenClipboard failed\n", thread_from_line);
ok(EmptyClipboard(), "%u: EmptyClipboard failed\n", thread_from_line );
return 0;
}
static DWORD WINAPI set_clipboard_data_thread(LPVOID arg)
{
HWND hwnd = arg;
@ -329,6 +337,8 @@ static void test_ClipboardOwner(void)
ok( ret, "CloseClipboard error %d\n", GetLastError());
run_thread( open_and_empty_clipboard_thread, 0, __LINE__ );
ok( !GetOpenClipboardWindow(), "wrong open window %p\n", GetOpenClipboardWindow() );
ok( !GetClipboardOwner(), "wrong owner window %p\n", GetClipboardOwner() );
ret = OpenClipboard( 0 );
ok( ret, "OpenClipboard error %d\n", GetLastError());
@ -347,6 +357,14 @@ static void test_ClipboardOwner(void)
ok( GetLastError() == ERROR_CLIPBOARD_NOT_OPEN, "wrong error %u\n", GetLastError() );
ok( !IsClipboardFormatAvailable( CF_WAVE ), "SetClipboardData succeeded\n" );
run_thread( open_and_empty_clipboard_thread, GetDesktopWindow(), __LINE__ );
ok( !GetOpenClipboardWindow(), "wrong open window %p\n", GetOpenClipboardWindow() );
ok( GetClipboardOwner() == GetDesktopWindow(), "wrong owner window %p / %p\n",
GetClipboardOwner(), GetDesktopWindow() );
run_thread( open_and_empty_clipboard_win_thread, 0, __LINE__ );
ok( !GetOpenClipboardWindow(), "wrong open window %p\n", GetOpenClipboardWindow() );
ok( !GetClipboardOwner(), "wrong owner window %p\n", GetClipboardOwner() );
}
static void test_RegisterClipboardFormatA(void)

View File

@ -220,7 +220,7 @@ void cleanup_clipboard_thread(struct thread *thread)
if ((clipboard = winstation->clipboard))
{
if (thread == clipboard->owner_thread) release_clipboard( clipboard );
if (thread == clipboard->owner_thread) clipboard->owner_thread = NULL;
if (thread == clipboard->open_thread)
{
user_handle_t viewer = close_clipboard( clipboard );