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
This commit is contained in:
parent
cac7d766b1
commit
eac4973697
2 changed files with 9 additions and 1 deletions
|
@ -1821,6 +1821,9 @@ void TestWaylandSeat::testSelection()
|
||||||
QVERIFY(cancelledSpy.isValid());
|
QVERIFY(cancelledSpy.isValid());
|
||||||
m_seatInterface->setSelection(ddi);
|
m_seatInterface->setSelection(ddi);
|
||||||
QVERIFY(cancelledSpy.wait());
|
QVERIFY(cancelledSpy.wait());
|
||||||
|
|
||||||
|
// Copy already cleared selection, BUG 383054
|
||||||
|
ddi->sendSelection(ddi);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestWaylandSeat::testSelectionNoDataSource()
|
void TestWaylandSeat::testSelectionNoDataSource()
|
||||||
|
|
|
@ -201,7 +201,12 @@ DataSourceInterface *DataDeviceInterface::selection() const
|
||||||
void DataDeviceInterface::sendSelection(DataDeviceInterface *other)
|
void DataDeviceInterface::sendSelection(DataDeviceInterface *other)
|
||||||
{
|
{
|
||||||
Q_D();
|
Q_D();
|
||||||
auto r = d->createDataOffer(other->selection());
|
auto otherSelection = other->selection();
|
||||||
|
if (!otherSelection) {
|
||||||
|
sendClearSelection();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
auto r = d->createDataOffer(otherSelection);
|
||||||
if (!r) {
|
if (!r) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue