Module: wine Branch: master Commit: 83367e874cc65d22fa5f30b2e3512c011818125f URL: http://source.winehq.org/git/wine.git/?a=commit;h=83367e874cc65d22fa5f30b2e3...
Author: Nikolay Sivov nsivov@codeweavers.com Date: Fri Mar 7 14:30:56 2014 +0400
user32/tests: Properly maintain clipboard viewers chain.
Without this CloseClipboard() will crash on Windows 8 if executed after test_messages().
---
dlls/user32/tests/clipboard.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/dlls/user32/tests/clipboard.c b/dlls/user32/tests/clipboard.c index d9ebb23..40218be 100644 --- a/dlls/user32/tests/clipboard.c +++ b/dlls/user32/tests/clipboard.c @@ -270,6 +270,7 @@ static void test_synthesized(void) }
static CRITICAL_SECTION clipboard_cs; +static HWND next_wnd; static LRESULT CALLBACK clipboard_wnd_proc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp) { switch(msg) { @@ -277,7 +278,14 @@ static LRESULT CALLBACK clipboard_wnd_proc(HWND hwnd, UINT msg, WPARAM wp, LPARA EnterCriticalSection(&clipboard_cs); LeaveCriticalSection(&clipboard_cs); break; + case WM_CHANGECBCHAIN: + if (next_wnd == (HWND)wp) + next_wnd = (HWND)lp; + else if (next_wnd) + SendMessageA(next_wnd, msg, wp, lp); + break; case WM_USER: + ChangeClipboardChain(hwnd, next_wnd); PostQuitMessage(0); break; } @@ -292,7 +300,7 @@ static DWORD WINAPI clipboard_thread(void *param)
EnterCriticalSection(&clipboard_cs); SetLastError(0xdeadbeef); - SetClipboardViewer(win); + next_wnd = SetClipboardViewer(win); ok(GetLastError() == 0xdeadbeef, "GetLastError = %d\n", GetLastError()); LeaveCriticalSection(&clipboard_cs);