freerdp/client-x11-fix-clipboard-update.patch
2026-05-11 17:35:23 -04:00

65 lines
2.0 KiB
Diff

From d9f55987f530bc881556fa61512865f4b07b1bb6 Mon Sep 17 00:00:00 2001
From: Ondrej Holy <oholy@redhat.com>
Date: Mon, 27 Apr 2026 14:53:46 +0000
Subject: [PATCH] [client,X11] fix clipboard update
Backport of commit 58409406afe7c2a8a71ed2dc8e22075be4f41c0c.
Adjusted hunk offsets for 3.10.3.
Made-with: Cursor
---
client/X11/xf_cliprdr.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/client/X11/xf_cliprdr.c b/client/X11/xf_cliprdr.c
index 265a66d..7a8ef71 100644
--- a/client/X11/xf_cliprdr.c
+++ b/client/X11/xf_cliprdr.c
@@ -850,7 +850,11 @@ static void xf_clipboard_formats_free(xfClipboard* clipboard)
{
WINPR_ASSERT(clipboard);
+ /* Synchronize RDP/X11 thread with channel thread */
+ xf_lock_x11(clipboard->xfc);
xf_cliprdr_free_formats(clipboard->lastSentFormats, clipboard->lastSentNumFormats);
+ xf_unlock_x11(clipboard->xfc);
+
clipboard->lastSentFormats = NULL;
clipboard->lastSentNumFormats = 0;
}
@@ -1862,24 +1866,23 @@ static UINT xf_cliprdr_send_client_format_list_response(xfClipboard* clipboard,
static UINT xf_cliprdr_monitor_ready(CliprdrClientContext* context,
const CLIPRDR_MONITOR_READY* monitorReady)
{
- UINT ret = 0;
- xfClipboard* clipboard = NULL;
-
WINPR_ASSERT(context);
WINPR_ASSERT(monitorReady);
- clipboard = cliprdr_file_context_get_context(context->custom);
+ xfClipboard* clipboard = cliprdr_file_context_get_context(context->custom);
WINPR_ASSERT(clipboard);
WINPR_UNUSED(monitorReady);
- if ((ret = xf_cliprdr_send_client_capabilities(clipboard)) != CHANNEL_RC_OK)
+ const UINT ret = xf_cliprdr_send_client_capabilities(clipboard);
+ if (ret != CHANNEL_RC_OK)
return ret;
xf_clipboard_formats_free(clipboard);
- if ((ret = xf_cliprdr_send_client_format_list(clipboard, TRUE)) != CHANNEL_RC_OK)
- return ret;
+ const UINT ret2 = xf_cliprdr_send_client_format_list(clipboard, TRUE);
+ if (ret2 != CHANNEL_RC_OK)
+ return ret2;
clipboard->sync = TRUE;
return CHANNEL_RC_OK;
--
2.53.0