From 0b3cca4ae05d72b7d79d606e266929413951d52c Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Fri, 18 Sep 2020 16:48:16 +0100 Subject: [PATCH] [DataOffer] Avoid calls on null DataSource A DataOffer can slightly outlive a DataSource; a client will still be told it's deleted but could call a method in a race. DataOfferInterface correctly checks for source being still valid, but nothing updates it when it gets deleted. BUG: 396308 --- src/wayland/server/dataoffer_interface_p.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/wayland/server/dataoffer_interface_p.h b/src/wayland/server/dataoffer_interface_p.h index 1be9403f45..d870419d03 100644 --- a/src/wayland/server/dataoffer_interface_p.h +++ b/src/wayland/server/dataoffer_interface_p.h @@ -8,6 +8,9 @@ #include "dataoffer_interface.h" #include "datasource_interface.h" #include "resource_p.h" + +#include + #include namespace KWaylandServer @@ -18,7 +21,7 @@ class Q_DECL_HIDDEN DataOfferInterface::Private : public Resource::Private public: Private(AbstractDataSource *source, DataDeviceInterface *parentInterface, DataOfferInterface *q, wl_resource *parentResource); ~Private(); - AbstractDataSource *source; + QPointer source; DataDeviceInterface *dataDevice; // defaults are set to sensible values for < version 3 interfaces DataDeviceManagerInterface::DnDActions supportedDnDActions = DataDeviceManagerInterface::DnDAction::Copy | DataDeviceManagerInterface::DnDAction::Move;