From 7b84db7a7484b58fdde21029ef374baeaa0a4b51 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Wed, 6 Oct 2010 12:37:05 +0200 Subject: spicec: Move setting of clipboard_owner to guest to platform code Atleast under x11 there is a race condition when setting the clipboard owner to guest from the RedClient code rather then doing it in Platform. After the XSetSelectionOwner() in Platform::on_clipboard_grab(), which runs from the main message loop thread, the x11 event thread can receive a SelectionRequest event from another x11 app, before the RedClient code has set the clipboard owner, which will trigger the owner != guest check in the SelectionRequest event handling code. By moving the setting of the owner in to Platform::on_clipboard_grab() it gets protected by the clipboard lock, which closes this tiny race. --- client/red_client.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'client/red_client.cpp') diff --git a/client/red_client.cpp b/client/red_client.cpp index 8e7dfe0e..0650e35a 100644 --- a/client/red_client.cpp +++ b/client/red_client.cpp @@ -1118,7 +1118,6 @@ void RedClient::dispatch_agent_message(VDAgentMessage* msg, void* data) case VD_AGENT_CLIPBOARD_GRAB: Platform::on_clipboard_grab((uint32_t *)data, msg->size / sizeof(uint32_t)); - Platform::set_clipboard_owner(Platform::owner_guest); break; case VD_AGENT_CLIPBOARD_REQUEST: if (Platform::get_clipboard_owner() != Platform::owner_client) { -- cgit