diff options
author | Laszlo Agocs <laszlo.p.agocs@nokia.com> | 2012-05-19 19:45:53 +0300 |
---|---|---|
committer | Jørgen Lind <jorgen.lind@nokia.com> | 2012-05-21 08:38:55 +0200 |
commit | 91982e550684777a2036ff0964d410d0dc9f2f9b (patch) | |
tree | 3820718eb0eb2e9e7cbe01f2abd4a5fe09ce6360 | |
parent | 42f6dd89261ef94099f05f9f813a25d0cce8d8ac (diff) |
Fix clipboard crash in clients with weston
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>
-rw-r--r-- | src/plugins/platforms/wayland/qwaylanddatadevicemanager.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/plugins/platforms/wayland/qwaylanddatadevicemanager.cpp b/src/plugins/platforms/wayland/qwaylanddatadevicemanager.cpp index 81972e83e..0975d24d6 100644 --- a/src/plugins/platforms/wayland/qwaylanddatadevicemanager.cpp +++ b/src/plugins/platforms/wayland/qwaylanddatadevicemanager.cpp @@ -170,6 +170,7 @@ void QWaylandDataDeviceManager::selection(void *data, 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; @@ -177,8 +178,12 @@ void QWaylandDataDeviceManager::selection(void *data, 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); } |