Commit 25d9fc3e authored by Alexandre Julliard's avatar Alexandre Julliard

server: Check for the current owner window on the server side for releases.

parent bdf3f413
...@@ -121,26 +121,15 @@ static BOOL CLIPBOARD_GetClipboardInfo(LPCLIPBOARDINFO cbInfo) ...@@ -121,26 +121,15 @@ static BOOL CLIPBOARD_GetClipboardInfo(LPCLIPBOARDINFO cbInfo)
/************************************************************************** /**************************************************************************
* CLIPBOARD_ReleaseOwner * CLIPBOARD_ReleaseOwner
*/ */
BOOL CLIPBOARD_ReleaseOwner(void) void CLIPBOARD_ReleaseOwner( HWND hwnd )
{ {
BOOL bRet = FALSE;
SERVER_START_REQ( set_clipboard_info ) SERVER_START_REQ( set_clipboard_info )
{ {
req->flags = SET_CB_RELOWNER | SET_CB_SEQNO; req->flags = SET_CB_RELOWNER | SET_CB_SEQNO;
req->owner = wine_server_user_handle( hwnd );
if (wine_server_call_err( req )) wine_server_call( req );
{
ERR("Failed to set clipboard.\n");
}
else
{
bRet = TRUE;
}
} }
SERVER_END_REQ; SERVER_END_REQ;
return bRet;
} }
......
...@@ -222,7 +222,7 @@ extern HMODULE user32_module DECLSPEC_HIDDEN; ...@@ -222,7 +222,7 @@ extern HMODULE user32_module DECLSPEC_HIDDEN;
struct dce; struct dce;
struct tagWND; struct tagWND;
extern BOOL CLIPBOARD_ReleaseOwner(void) DECLSPEC_HIDDEN; extern void CLIPBOARD_ReleaseOwner( HWND hwnd ) DECLSPEC_HIDDEN;
extern BOOL FOCUS_MouseActivate( HWND hwnd ) DECLSPEC_HIDDEN; extern BOOL FOCUS_MouseActivate( HWND hwnd ) DECLSPEC_HIDDEN;
extern BOOL set_capture_window( HWND hwnd, UINT gui_flags, HWND *prev_ret ) DECLSPEC_HIDDEN; extern BOOL set_capture_window( HWND hwnd, UINT gui_flags, HWND *prev_ret ) DECLSPEC_HIDDEN;
extern void free_dce( struct dce *dce, HWND hwnd ) DECLSPEC_HIDDEN; extern void free_dce( struct dce *dce, HWND hwnd ) DECLSPEC_HIDDEN;
......
...@@ -1875,8 +1875,7 @@ BOOL WINAPI DestroyWindow( HWND hwnd ) ...@@ -1875,8 +1875,7 @@ BOOL WINAPI DestroyWindow( HWND hwnd )
WIN_SendDestroyMsg( hwnd ); WIN_SendDestroyMsg( hwnd );
if (!IsWindow( hwnd )) return TRUE; if (!IsWindow( hwnd )) return TRUE;
if (GetClipboardOwner() == hwnd) CLIPBOARD_ReleaseOwner( hwnd );
CLIPBOARD_ReleaseOwner();
/* Destroy the window storage */ /* Destroy the window storage */
......
...@@ -172,11 +172,12 @@ static int set_clipboard_owner( struct clipboard *clipboard, user_handle_t win ) ...@@ -172,11 +172,12 @@ static int set_clipboard_owner( struct clipboard *clipboard, user_handle_t win )
return 1; return 1;
} }
static int release_clipboard_owner( struct clipboard *clipboard ) static int release_clipboard_owner( struct clipboard *clipboard, user_handle_t win )
{ {
if (clipboard->open_thread && clipboard->open_thread->process != current->process) if ((clipboard->open_thread && clipboard->open_thread->process != current->process) ||
(win && clipboard->owner_win != get_user_full_handle( win )))
{ {
set_error(STATUS_WAS_LOCKED); set_win32_error( ERROR_CLIPBOARD_NOT_OPEN );
return 0; return 0;
} }
clipboard->owner_win = 0; clipboard->owner_win = 0;
...@@ -221,7 +222,7 @@ DECL_HANDLER(set_clipboard_info) ...@@ -221,7 +222,7 @@ DECL_HANDLER(set_clipboard_info)
} }
else if (req->flags & SET_CB_RELOWNER) else if (req->flags & SET_CB_RELOWNER)
{ {
if (!release_clipboard_owner( clipboard )) return; if (!release_clipboard_owner( clipboard, req->owner )) return;
} }
if (req->flags & SET_CB_VIEWER) clipboard->viewer = get_user_full_handle( req->viewer ); if (req->flags & SET_CB_VIEWER) clipboard->viewer = get_user_full_handle( req->viewer );
......
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