Bug 439765 - Clipboard is intermittently broken in the Wayland session when "Prevent Empty Clipboard" is enabled
Summary: Clipboard is intermittently broken in the Wayland session when "Prevent Empty...
Status: RESOLVED DUPLICATE of bug 424754
Alias: None
Product: plasmashell
Classification: Plasma
Component: general (show other bugs)
Version: 5.22.3
Platform: Debian testing Linux
: NOR normal
Target Milestone: 1.0
Assignee: David Edmundson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-07-12 02:36 UTC by Shmerl
Modified: 2021-08-03 23:16 UTC (History)
7 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Shmerl 2021-07-12 02:36:22 UTC
Trying the Wayland session in Plasma 5.22.3 / frameworks 5.84.0 / Qt 5.15.2, I experienced a problem with clipboard that's similar to other reports in bug 424754, except it's with pure Wayland / Qt use case, no XWayland or GTK involved.

Scenario:

1. Open Kate and type in some text in it, open Konsole.
2. Copy some text from Kate, paste it in Konsole - works OK.
3. Copy some other text from Kate, paste it Konsole - nothing is getting pasted.

This happens intermittently, i.e. sometimes it copy / pastes, sometimes it doesn't. When it doesn't, Klipper shows current content as empty.
Comment 1 David Edmundson 2021-07-12 11:18:51 UTC
Please can you confirm that kate and konsole are both running in wayland mode.
One fast way is to run "xprop" and hover the two windows. If you get a + cursor, it's X.

Please also attach 

WAYLAND_DEBUG=1 kate |& grep data

and try and isolate what happens when it fails to copy
Comment 2 Shmerl 2021-07-12 22:03:06 UTC
Both windows are Wayland windows. Also confirmed with KWin console that no XWayland windows are present.

Successful selection:

[597918.013] zwp_primary_selection_device_v1@12.data_offer(new id zwp_primary_selection_offer_v1@3633541696)
[599702.263]  -> wl_data_device_manager@9.create_data_source(new id wl_data_source@39)
[599702.277]  -> wl_data_source@39.offer("text/plain")
[599702.280]  -> wl_data_source@39.offer("text/plain;charset=utf-8")
[599702.284]  -> wl_data_device@10.set_selection(wl_data_source@39, 2099)
[599702.383] wl_data_device@10.data_offer(new id wl_data_offer@3632315184)
[599702.389] wl_data_offer@4278190082.offer("text/plain")
[599702.393] wl_data_offer@4278190082.offer("text/plain;charset=utf-8")
[599702.397] wl_data_device@10.selection(wl_data_offer@4278190082)
[599702.401]  -> wl_data_offer@4278190080.destroy()
[599702.554] wl_data_source@39.send("text/plain;charset=utf-8", fd 16)
[599702.805] wl_data_source@39.cancelled()
[599702.815]  -> wl_data_source@39.destroy()
[599702.823] wl_data_device@10.selection(nil)
[599702.825]  -> wl_data_offer@4278190082.destroy()
[599702.846] wl_data_device@10.data_offer(new id wl_data_offer@3633539552)
[599702.851] wl_data_offer@4278190080.offer("text/plain")
[599702.854] wl_data_offer@4278190080.offer("application/x-kde-onlyReplaceEmpty")
[599702.857] wl_data_offer@4278190080.offer("text/plain;charset=utf-8")
[599702.863] wl_data_device@10.selection(wl_data_offer@4278190080)
[605543.702]  -> wl_data_offer@4278190080.destroy()

Bad selection:

[733959.295] zwp_primary_selection_device_v1@12.data_offer(new id zwp_primary_selection_offer_v1@3633571472)
[734759.439]  -> wl_data_device_manager@9.create_data_source(new id wl_data_source@47)
[734759.449]  -> wl_data_source@47.offer("text/plain")
[734759.452]  -> wl_data_source@47.offer("text/plain;charset=utf-8")
[734759.457]  -> wl_data_device@10.set_selection(wl_data_source@47, 2797)
[734759.565] wl_data_device@10.data_offer(new id wl_data_offer@3633449056)
[734759.572] wl_data_offer@4278190082.offer("text/plain")
[734759.577] wl_data_offer@4278190082.offer("text/plain;charset=utf-8")
[734759.579] wl_data_device@10.selection(wl_data_offer@4278190082)
[734759.583]  -> wl_data_offer@4278190081.destroy()
[734760.041] wl_data_source@47.cancelled()
[734760.059]  -> wl_data_source@47.destroy()
[734760.066] wl_data_device@10.selection(nil)
[734760.069]  -> wl_data_offer@4278190082.destroy()
[734760.260] wl_data_device@10.data_offer(new id wl_data_offer@3633496752)
[734760.264] wl_data_offer@4278190082.offer("text/plain")
[734760.268] wl_data_offer@4278190082.offer("application/x-kde-onlyReplaceEmpty")
[734760.270] wl_data_offer@4278190082.offer("text/plain;charset=utf-8")
[734760.273] wl_data_device@10.selection(wl_data_offer@4278190082)
[736764.890]  -> wl_data_offer@4278190082.destroy()
[737620.024] wl_data_device@10.data_offer(new id wl_data_offer@3633571472)
[737620.029] wl_data_offer@4278190080.offer("text/plain")
[737620.033] wl_data_offer@4278190080.offer("application/x-kde-onlyReplaceEmpty")
[737620.035] wl_data_offer@4278190080.offer("text/plain;charset=utf-8")
[737620.037] wl_data_device@10.selection(wl_data_offer@4278190080)
[737620.041] zwp_primary_selection_device_v1@12.data_offer(new id zwp_primary_selection_offer_v1@3633458032)
[738569.965]  -> wl_data_offer@4278190080.destroy()
Comment 3 Shmerl 2021-07-12 22:05:19 UTC
I also tried experimenting with some options in Klipper settings, and noticed that this bug doesn't happen when "Prevent empty clipboard" is unchecked. It happens the above option is enabled.
Comment 4 David Edmundson 2021-07-12 22:19:58 UTC
Even that first one looks weird:

Annotating the above in plain text. Commments are from the POV of kate.

[599702.263]  -> wl_data_device_manager@9.create_data_source(new id wl_data_source@39)
[599702.277]  -> wl_data_source@39.offer("text/plain")
[599702.280]  -> wl_data_source@39.offer("text/plain;charset=utf-8")
[599702.284]  -> wl_data_device@10.set_selection(wl_data_source@39, 2099)


We offer a selection (39)

[599702.383] wl_data_device@10.data_offer(new id wl_data_offer@3632315184)
[599702.389] wl_data_offer@4278190082.offer("text/plain")
[599702.393] wl_data_offer@4278190082.offer("text/plain;charset=utf-8")
[599702.397] wl_data_device@10.selection(wl_data_offer@4278190082)

We are told there is a new selection available (probably our own back at us)

[599702.401]  -> wl_data_offer@4278190080.destroy()

We drop the our reference to the last offer as it's now outdated.

[599702.554] wl_data_source@39.send("text/plain;charset=utf-8", fd 16)
The data from 39 is requested

[599702.805] wl_data_source@39.cancelled()
Source 39 is cancelled, after a slight delay, not just kwayland server doing something on its own.

This is the interesting part.

[599702.815]  -> wl_data_source@39.destroy()

We drop source 39 as we have been told it's cancelled


[599702.823] wl_data_device@10.selection(nil)

We are tod that the clipboard is now empty

[599702.825]  -> wl_data_offer@4278190082.destroy()

We drop the our reference to the last offer as we have been todl the clipboard is empty

[599702.846] wl_data_device@10.data_offer(new id wl_data_offer@3633539552)
[599702.851] wl_data_offer@4278190080.offer("text/plain")
[599702.854] wl_data_offer@4278190080.offer("application/x-kde-onlyReplaceEmpty")
[599702.857] wl_data_offer@4278190080.offer("text/plain;charset=utf-8")
[599702.863] wl_data_device@10.selection(wl_data_offer@4278190080)

We are told that klipper has the clipboard. The additional mime shows it's from klipper
Comment 5 Shmerl 2021-07-12 22:26:03 UTC
If it matters, my other settings from Klipper:

"Ignore selection": checked.
"Text selection only": unchecked
"Synchronize contents of the clipboard and the selection": unchecked.

Timeout for action popups: 8 seconds
Clipboard history size: 1 entry.
Comment 6 Nate Graham 2021-08-03 23:13:51 UTC
Cannot reproduce with current git master FWIW.
Comment 7 Nate Graham 2021-08-03 23:15:26 UTC
I think this is the same as Bug 424754 after all.

*** This bug has been marked as a duplicate of bug 424754 ***