Add safety checks to DataDeviceInterface

It's possible that the Resource got already unbound when calling
into clear selection, etc.
This commit is contained in:
Martin Gräßlin 2014-11-27 14:02:54 +01:00
parent 91fa946e30
commit 963651632e

View file

@ -174,12 +174,18 @@ void DataDeviceInterface::sendSelection(DataDeviceInterface *other)
if (!r) {
return;
}
if (!d->resource) {
return;
}
wl_data_device_send_selection(d->resource, r->resource());
}
void DataDeviceInterface::sendClearSelection()
{
Q_D();
if (!d->resource) {
return;
}
wl_data_device_send_selection(d->resource, nullptr);
}