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:
parent
91fa946e30
commit
963651632e
1 changed files with 6 additions and 0 deletions
|
@ -174,12 +174,18 @@ void DataDeviceInterface::sendSelection(DataDeviceInterface *other)
|
||||||
if (!r) {
|
if (!r) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!d->resource) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
wl_data_device_send_selection(d->resource, r->resource());
|
wl_data_device_send_selection(d->resource, r->resource());
|
||||||
}
|
}
|
||||||
|
|
||||||
void DataDeviceInterface::sendClearSelection()
|
void DataDeviceInterface::sendClearSelection()
|
||||||
{
|
{
|
||||||
Q_D();
|
Q_D();
|
||||||
|
if (!d->resource) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
wl_data_device_send_selection(d->resource, nullptr);
|
wl_data_device_send_selection(d->resource, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue