summaryrefslogtreecommitdiffstats
path: root/src/compositor/wayland_wrapper/qwldatadevice.cpp
diff options
context:
space:
mode:
authorAndrew Knight <andrew.knight@digia.com>2013-12-13 10:22:56 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-12-16 11:36:15 +0100
commit3acb072cf626a3d5358f2189de66a4f86324d333 (patch)
tree39e2b07c79b24996c237c24c9199d1aafd47ce68 /src/compositor/wayland_wrapper/qwldatadevice.cpp
parent311a4a4eb749724e5d8c070f144442b6d552cba9 (diff)
QtCompositor: Handle destroyed DataSource objects in DataDevice
Fast selections can create dangling pointers to DataSource objects, so make sure the DataDevice is aware of DataSource destruction. Change-Id: Ibcb7eec3b3403bd6ee53b6f09815d78148f65b4d Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
Diffstat (limited to 'src/compositor/wayland_wrapper/qwldatadevice.cpp')
-rw-r--r--src/compositor/wayland_wrapper/qwldatadevice.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/compositor/wayland_wrapper/qwldatadevice.cpp b/src/compositor/wayland_wrapper/qwldatadevice.cpp
index 2257455f4..7d183ce27 100644
--- a/src/compositor/wayland_wrapper/qwldatadevice.cpp
+++ b/src/compositor/wayland_wrapper/qwldatadevice.cpp
@@ -125,6 +125,12 @@ Surface *DataDevice::dragIcon() const
return m_dragIcon;
}
+void DataDevice::sourceDestroyed(DataSource *source)
+{
+ if (m_selectionSource == source)
+ m_selectionSource = 0;
+}
+
void DataDevice::focus()
{
Surface *focus = m_compositor->pickSurface(m_pointer->currentPosition());
@@ -196,6 +202,8 @@ void DataDevice::data_device_set_selection(Resource *, struct ::wl_resource *sou
m_selectionSource->cancel();
m_selectionSource = dataSource;
+ if (m_selectionSource)
+ m_selectionSource->setDevice(this);
QtWaylandServer::wl_keyboard::Resource *focusResource = m_inputDevice->keyboardDevice()->focusResource();
Resource *resource = focusResource ? resourceMap().value(focusResource->client()) : 0;