Commit eac49736 authored by David Edmundson's avatar David Edmundson
Browse files

Avoid sending data offers from an invalid source.

Summary:
A DataDevice will have a source when offers are available, but it can
also be legitimately cleared.

When calling DataDeviceInterface::sendSelection(DataDeviceInterface
*other) if the other data device has no source, we should be setting
that we also have no source.

In addition this also guards against Seat tracking a DataDeviceInterface
with no source when trying to sync x clipboards.

BUG: 383054

Reviewers: #plasma

Subscribers: graesslin, plasma-devel, #frameworks

Tags: #plasma_on_wayland, #frameworks

Differential Revision: https://phabricator.kde.org/D7316
parent cac7d766
......@@ -1821,6 +1821,9 @@ void TestWaylandSeat::testSelection()
QVERIFY(cancelledSpy.isValid());
m_seatInterface->setSelection(ddi);
QVERIFY(cancelledSpy.wait());
// Copy already cleared selection, BUG 383054
ddi->sendSelection(ddi);
}
void TestWaylandSeat::testSelectionNoDataSource()
......
......@@ -201,7 +201,12 @@ DataSourceInterface *DataDeviceInterface::selection() const
void DataDeviceInterface::sendSelection(DataDeviceInterface *other)
{
Q_D();
auto r = d->createDataOffer(other->selection());
auto otherSelection = other->selection();
if (!otherSelection) {
sendClearSelection();
return;
}
auto r = d->createDataOffer(otherSelection);
if (!r) {
return;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment