From 03a253c211f0404a53288992d04980379889be16 Mon Sep 17 00:00:00 2001 From: Dan Page <26827986+D-Pagey@users.noreply.github.com> Date: Sun, 13 Sep 2026 17:50:05 +0100 Subject: [PATCH] Fix clipboard deadlock by removing aggressive Wayland image watcher --- shell/plugins/clipboard/Clipboard.qml | 11 +---------- test/shell.d/clipboard-test.sh | 8 ++++---- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/shell/plugins/clipboard/Clipboard.qml b/shell/plugins/clipboard/Clipboard.qml index da969e65dc2b..9d04670741aa 100644 --- a/shell/plugins/clipboard/Clipboard.qml +++ b/shell/plugins/clipboard/Clipboard.qml @@ -267,7 +267,6 @@ Item { onExited: { currentProc.running = true textWatchProc.running = true - imageWatchProc.running = true } } @@ -289,14 +288,7 @@ Item { } } - Process { - id: imageWatchProc - command: ["setpriv", "--pdeathsig", "TERM", "wl-paste", "--type", "image/png", "--watch", root.captureScript, "image/png"] - onExited: watchRestartTimer.restart() - stdout: SplitParser { - onRead: function(data) { root.addClipboardJson(data) } - } - } + // A watcher that dies takes clipboard history with it, silently: copying still // works, the picker still opens, and the old entries are all still there, so @@ -307,7 +299,6 @@ Item { repeat: false onTriggered: { if (!textWatchProc.running) textWatchProc.running = true - if (!imageWatchProc.running) imageWatchProc.running = true } } diff --git a/test/shell.d/clipboard-test.sh b/test/shell.d/clipboard-test.sh index 962d529e0f4a..f2c6b875ccdf 100644 --- a/test/shell.d/clipboard-test.sh +++ b/test/shell.d/clipboard-test.sh @@ -167,8 +167,8 @@ assert( 'clipboard text watcher dies with the shell via pdeathsig' ) assert( - clipboardQml.includes('command: ["setpriv", "--pdeathsig", "TERM", "wl-paste", "--type", "image/png", "--watch", root.captureScript, "image/png"]'), - 'clipboard image watcher dies with the shell via pdeathsig' + !clipboardQml.includes('wl-paste", "--type", "image/png", "--watch'), + 'clipboard avoids watching images to prevent consuming single-use Wayland pipes' ) assert( clipboardQml.includes('command: ["pkill", "-f", "wl-paste .*--watch .*/shell/plugins/clipboard/capture\\\\.sh"]'), @@ -176,8 +176,8 @@ assert( ) assertEqual( (clipboardQml.match(/onExited: watchRestartTimer\.restart\(\)/g) || []).length, - 2, - 'clipboard respawns both watchers when they die' + 1, + 'clipboard respawns the text watcher when it dies' ) assertDeepEqual(