Bug 368391

Summary: Wayland clipboard breaks some times
Product: [Frameworks and Libraries] kwayland Reporter: CapsAdmin <eliashogstvedt>
Component: serverAssignee: Martin Flöser <mgraesslin>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version First Reported In: 5.24.0   
Target Milestone: ---   
Platform: Neon   
OS: Linux   
URL: https://phabricator.kde.org/D2743
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description CapsAdmin 2016-09-07 13:15:03 UTC
there's talk about this here: 
https://blog.martin-graesslin.com/blog/2016/07/synchronizing-the-x11-and-wayland-clipboard/
but this was a while ago

Reproducible: Always
Comment 1 Martin Flöser 2016-09-07 20:23:54 UTC
It's not specific to X11 to Wayland, but in general the Wayland clipboard tends to break sometimes. I'm quite aware of it, but haven't figured out yet why this happens and also not a reliable way to reproduce it.
Comment 2 Martin Flöser 2016-09-09 14:01:20 UTC
Problem is investigated and I have a working patch, just need to do some more testing. The problem is that KWayland does not send canceled to a DataSource which got replaced. QtWayland uses the internal DataSource to paste from. So whenever one copied once from a Qt window it was no longer possible to paste into it.
Comment 3 Martin Flöser 2016-09-12 07:02:56 UTC
Possible fix at https://phabricator.kde.org/D2743
Comment 4 Martin Flöser 2016-09-14 08:22:58 UTC
Git commit 8163515980e31911fa3f49120c4dd203f014da56 by Martin Gräßlin.
Committed on 14/09/2016 at 08:22.
Pushed by graesslin into branch 'master'.

[server] When replacing the clipboard selection previous DataSource needs to be cancelled

Summary:
According to the Wayland documentation a data source needs to be
cancelled whenever it is no longer valid. A reason for no longer being
valid is that the data source has been replaced by another data source.

So far KWayland did not implement this aspect which resulted in clipboard
breaking in QtWayland applications. As soon as one copied once from an
application it was no longer possible to paste to it from another
application.

With this change the data source gets properly cancelled and also
ensured that the server code doesn't run into a possible crash condition
when trying to cancel an already unbound data source.

Reviewers: #plasma_on_wayland

Subscribers: plasma-devel

Tags: #plasma_on_wayland

Differential Revision: https://phabricator.kde.org/D2743

M  +74   -0    autotests/client/test_datadevice.cpp
M  +14   -0    src/server/datadevice_interface.cpp
M  +5    -0    src/server/datasource_interface.cpp
M  +10   -0    src/server/seat_interface.cpp

http://commits.kde.org/kwayland/8163515980e31911fa3f49120c4dd203f014da56