Commit 5962df3a authored by Alexandre Julliard's avatar Alexandre Julliard

server: Cleanup clipboard information upon window destruction.

parent 43e38153
......@@ -266,13 +266,13 @@ static void test_ClipboardOwner(void)
ok( ret, "DestroyWindow error %d\n", GetLastError());
SetLastError(0xdeadbeef);
ok(!GetClipboardOwner() && GetLastError() == 0xdeadbeef, "clipboard should not be owned\n");
todo_wine ok(!GetClipboardViewer() && GetLastError() == 0xdeadbeef, "viewer still exists\n");
todo_wine ok(!GetOpenClipboardWindow() && GetLastError() == 0xdeadbeef, "clipboard should not be open\n");
ok(!GetClipboardViewer() && GetLastError() == 0xdeadbeef, "viewer still exists\n");
ok(!GetOpenClipboardWindow() && GetLastError() == 0xdeadbeef, "clipboard should not be open\n");
SetLastError( 0xdeadbeef );
ret = CloseClipboard();
todo_wine ok( !ret, "CloseClipboard succeeded\n" );
todo_wine ok( GetLastError() == ERROR_CLIPBOARD_NOT_OPEN, "wrong error %u\n", GetLastError() );
ok( !ret, "CloseClipboard succeeded\n" );
ok( GetLastError() == ERROR_CLIPBOARD_NOT_OPEN, "wrong error %u\n", GetLastError() );
ret = OpenClipboard( 0 );
ok( ret, "OpenClipboard error %d\n", GetLastError());
......
......@@ -111,6 +111,25 @@ static struct clipboard *get_process_clipboard(void)
return clipboard;
}
/* cleanup clipboard information upon window destruction */
void cleanup_clipboard_window( struct desktop *desktop, user_handle_t window )
{
struct clipboard *clipboard = desktop->winstation->clipboard;
if (!clipboard) return;
if (clipboard->open_win == window)
{
clipboard->open_win = 0;
clipboard->open_thread = NULL;
}
if (clipboard->owner_win == window)
{
clipboard->owner_win = 0;
clipboard->owner_thread = NULL;
}
if (clipboard->viewer == window) clipboard->viewer = 0;
}
/* Called when thread terminates to allow release of clipboard */
void cleanup_clipboard_thread(struct thread *thread)
......
......@@ -91,6 +91,7 @@ extern void free_process_user_handles( struct process *process );
/* clipboard functions */
extern void cleanup_clipboard_window( struct desktop *desktop, user_handle_t window );
extern void cleanup_clipboard_thread( struct thread *thread );
/* hook functions */
......
......@@ -1855,6 +1855,7 @@ void destroy_window( struct window *win )
if (win == progman_window) progman_window = NULL;
if (win == taskman_window) taskman_window = NULL;
free_hotkeys( win->desktop, win->handle );
cleanup_clipboard_window( win->desktop, win->handle );
free_user_handle( win->handle );
destroy_properties( win );
list_remove( &win->entry );
......
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