diff --git a/src/compositor/wayland_wrapper/qwldataoffer_p.h b/src/compositor/wayland_wrapper/qwldataoffer_p.h
index 5911819d85b620edebbe296b8dc1f9c3a391ebdd..643322f326bc6780ddb0276afa0c1a334122b396 100644
--- a/src/compositor/wayland_wrapper/qwldataoffer_p.h
+++ b/src/compositor/wayland_wrapper/qwldataoffer_p.h
@@ -41,6 +41,7 @@
 #ifndef WLDATAOFFER_H
 #define WLDATAOFFER_H
 
+#include <QPointer>
 #include <QtCompositor/private/qwayland-server-wayland.h>
 
 QT_BEGIN_NAMESPACE
@@ -63,7 +64,7 @@ protected:
     void data_offer_destroy_resource(Resource *resource) Q_DECL_OVERRIDE;
 
 private:
-    DataSource *m_dataSource;
+    QPointer<DataSource> m_dataSource;
 };
 
 }
diff --git a/src/compositor/wayland_wrapper/qwldatasource_p.h b/src/compositor/wayland_wrapper/qwldatasource_p.h
index 01ac4cbd96eeb60cd6d27a037be284900a2a22a2..013f4b54f8a9f5346f22525a68b112ee8bf13e4b 100644
--- a/src/compositor/wayland_wrapper/qwldatasource_p.h
+++ b/src/compositor/wayland_wrapper/qwldatasource_p.h
@@ -42,7 +42,7 @@
 #define WLDATASOURCE_H
 
 #include <QtCompositor/private/qwayland-server-wayland.h>
-
+#include <QObject>
 #include <QtCore/QList>
 
 QT_BEGIN_NAMESPACE
@@ -53,7 +53,7 @@ class DataOffer;
 class DataDevice;
 class DataDeviceManager;
 
-class DataSource : public QtWaylandServer::wl_data_source
+class DataSource : public QObject, public QtWaylandServer::wl_data_source
 {
 public:
     DataSource(struct wl_client *client, uint32_t id, uint32_t time);