Changeset View
Changeset View
Standalone View
Standalone View
src/client/datadevice.cpp
Show All 35 Lines | |||||
36 | { | 36 | { | ||
37 | public: | 37 | public: | ||
38 | explicit Private(DataDevice *q); | 38 | explicit Private(DataDevice *q); | ||
39 | void setup(wl_data_device *d); | 39 | void setup(wl_data_device *d); | ||
40 | 40 | | |||
41 | WaylandPointer<wl_data_device, wl_data_device_release> device; | 41 | WaylandPointer<wl_data_device, wl_data_device_release> device; | ||
42 | QScopedPointer<DataOffer> selectionOffer; | 42 | QScopedPointer<DataOffer> selectionOffer; | ||
43 | struct Drag { | 43 | struct Drag { | ||
44 | DataOffer *offer = nullptr; | 44 | QPointer<DataOffer> offer; | ||
45 | QPointer<Surface> surface; | 45 | QPointer<Surface> surface; | ||
46 | }; | 46 | }; | ||
47 | Drag drag; | 47 | Drag drag; | ||
48 | 48 | | |||
49 | private: | 49 | private: | ||
50 | void dataOffer(wl_data_offer *id); | 50 | void dataOffer(wl_data_offer *id); | ||
51 | void selection(wl_data_offer *id); | 51 | void selection(wl_data_offer *id); | ||
52 | void dragEnter(quint32 serial, const QPointer<Surface> &surface, const QPointF &relativeToSurface, wl_data_offer *dataOffer); | 52 | void dragEnter(quint32 serial, const QPointer<Surface> &surface, const QPointF &relativeToSurface, wl_data_offer *dataOffer); | ||
▲ Show 20 Lines • Show All 116 Lines • ▼ Show 20 Line(s) | |||||
169 | DataDevice::DataDevice(QObject *parent) | 169 | DataDevice::DataDevice(QObject *parent) | ||
170 | : QObject(parent) | 170 | : QObject(parent) | ||
171 | , d(new Private(this)) | 171 | , d(new Private(this)) | ||
172 | { | 172 | { | ||
173 | } | 173 | } | ||
174 | 174 | | |||
175 | DataDevice::~DataDevice() | 175 | DataDevice::~DataDevice() | ||
176 | { | 176 | { | ||
177 | if (d->drag.offer) { | ||||
broulik: `delete nullptr` is just fine | |||||
178 | delete d->drag.offer; | ||||
179 | } | ||||
177 | release(); | 180 | release(); | ||
178 | } | 181 | } | ||
179 | 182 | | |||
180 | void DataDevice::destroy() | 183 | void DataDevice::destroy() | ||
181 | { | 184 | { | ||
182 | d->device.destroy(); | 185 | d->device.destroy(); | ||
183 | } | 186 | } | ||
184 | 187 | | |||
▲ Show 20 Lines • Show All 76 Lines • Show Last 20 Lines |
delete nullptr is just fine