diff options
author | Giulio Camuffo <giulio.camuffo@jollamobile.com> | 2014-04-22 11:10:46 +0300 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-04-24 13:40:10 +0200 |
commit | 72de139c485fb1b37f993fd198f8ffcd2efa794d (patch) | |
tree | a57242b22c0210f274f4307c1cc6f468803e8d25 /src/compositor/wayland_wrapper/qwldatadevicemanager.cpp | |
parent | 48126502434c0c966a744e113b4a420656d8c206 (diff) |
Fix unsetting the wl_data_device selection
Calling wl_data_device_set_selection with a NULL source is valid,
so do not crash.
Change-Id: I8ceb21366e19df703aff75c10091ee8570488848
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
Diffstat (limited to 'src/compositor/wayland_wrapper/qwldatadevicemanager.cpp')
-rw-r--r-- | src/compositor/wayland_wrapper/qwldatadevicemanager.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/compositor/wayland_wrapper/qwldatadevicemanager.cpp b/src/compositor/wayland_wrapper/qwldatadevicemanager.cpp index 98852a2b4..2c59f1b52 100644 --- a/src/compositor/wayland_wrapper/qwldatadevicemanager.cpp +++ b/src/compositor/wayland_wrapper/qwldatadevicemanager.cpp @@ -70,7 +70,7 @@ DataDeviceManager::DataDeviceManager(Compositor *compositor) void DataDeviceManager::setCurrentSelectionSource(DataSource *source) { - if (m_current_selection_source + if (m_current_selection_source && source && m_current_selection_source->time() > source->time()) { qDebug() << "Trying to set older selection"; return; @@ -81,7 +81,8 @@ void DataDeviceManager::setCurrentSelectionSource(DataSource *source) finishReadFromClient(); m_current_selection_source = source; - source->setManager(this); + if (source) + source->setManager(this); // When retained selection is enabled, the compositor will query all the data from the client. // This makes it possible to @@ -89,7 +90,7 @@ void DataDeviceManager::setCurrentSelectionSource(DataSource *source) // 2. make it possible for the compositor to participate in copy-paste // The downside is decreased performance, therefore this mode has to be enabled // explicitly in the compositors. - if (m_compositor->retainedSelectionEnabled()) { + if (source && m_compositor->retainedSelectionEnabled()) { m_retainedData.clear(); m_retainedReadIndex = 0; retain(); |