The offer passed to selection() can be null. This case was not handled
before because it never happens with qt-compositor. Copy/paste is still
not ok with weston but at least the apps won't crash.
Change-Id: I91d529e9d8b179724637d05bb9b95ec5843bda2b
Reviewed-by: Jørgen Lind <jorgen.lind@nokia.com>
struct wl_data_offer *id)
{
Q_UNUSED(wl_data_device);
+
QWaylandDataDeviceManager *handler = static_cast<QWaylandDataDeviceManager *>(data);
QWaylandDataOffer *mime = handler->m_selection_data_offer;
delete mime;
delete transfer_source;
handler->m_selection_data_source = 0;
- mime = static_cast<QWaylandDataOffer *>(wl_data_offer_get_user_data(id));
- handler->m_selection_data_offer = mime;
+ if (id) {
+ mime = static_cast<QWaylandDataOffer *>(wl_data_offer_get_user_data(id));
+ handler->m_selection_data_offer = mime;
+ } else {
+ handler->m_selection_data_offer = 0;
+ }
QGuiApplicationPrivate::platformIntegration()->clipboard()->emitChanged(QClipboard::Clipboard);
}