diff --git a/src/client/qwaylanddatadevice.cpp b/src/client/qwaylanddatadevice.cpp
index 74f879f972d2aeefd7bf9c984387402fd87d3918..83e74ce6ca9e09bce147aec26f732582ca0eb6ce 100644
--- a/src/client/qwaylanddatadevice.cpp
+++ b/src/client/qwaylanddatadevice.cpp
@@ -60,6 +60,7 @@
 QWaylandDataDevice::QWaylandDataDevice(QWaylandDataDeviceManager *manager, QWaylandInputDevice *inputDevice)
     : QtWayland::wl_data_device(manager->get_data_device(inputDevice->wl_seat()))
     , m_display(manager->display())
+    , m_inputDevice(inputDevice)
     , m_enterSerial(0)
     , m_dragWindow(0)
     , m_dragPoint()
@@ -92,7 +93,7 @@ void QWaylandDataDevice::setSelectionSource(QWaylandDataSource *source)
     m_selectionSource.reset(source);
     if (source)
         connect(source, &QWaylandDataSource::cancelled, this, &QWaylandDataDevice::selectionSourceCancelled);
-    set_selection(source ? source->object() : 0, 0 /* TODO m_display->serial() */);
+    set_selection(source ? source->object() : Q_NULLPTR, m_inputDevice->serial());
 }
 
 QWaylandDataOffer *QWaylandDataDevice::dragOffer() const
diff --git a/src/client/qwaylanddatadevice_p.h b/src/client/qwaylanddatadevice_p.h
index dae91290ebf49b395c346f4e9b9dfdb947ae1993..ef82d84ddb32a23bfbe695219f7af0813690a131 100644
--- a/src/client/qwaylanddatadevice_p.h
+++ b/src/client/qwaylanddatadevice_p.h
@@ -88,7 +88,7 @@ private Q_SLOTS:
 
 private:
     QWaylandDisplay *m_display;
-
+    QWaylandInputDevice *m_inputDevice;
     uint32_t m_enterSerial;
     QWindow *m_dragWindow;
     QPoint m_dragPoint;