Fix use-after-free error in autotest
zwp_primary_selection_device_v1::destroy_func() uses the object after calling zwp_primary_selection_device_v1_destroy_resource(). This means that we cannot do "delete this" at that point. Instead delete all the devices in the destructor of PrimarySelectionDeviceManagerV1, which conveniently already has a list of selection devices. Fixes: QTBUG-117068 Change-Id: I7012f801ef11283d5b66cefbf5481e9f1394f1b8 Reviewed-by: Vlad Zahorodnii <vlad.zahorodnii@kde.org> Reviewed-by: David Edmundson <davidedmundson@kde.org>
This commit is contained in:
parent
fa89154807
commit
1110b2c3e4
@ -129,11 +129,6 @@ protected:
|
||||
{
|
||||
wl_resource_destroy(resource->handle);
|
||||
}
|
||||
void zwp_primary_selection_device_v1_destroy_resource(Resource *resource) override
|
||||
{
|
||||
Q_UNUSED(resource);
|
||||
delete this;
|
||||
}
|
||||
};
|
||||
|
||||
class PrimarySelectionDeviceManagerV1 : public Global, public QtWaylandServer::zwp_primary_selection_device_manager_v1
|
||||
@ -144,6 +139,10 @@ public:
|
||||
: QtWaylandServer::zwp_primary_selection_device_manager_v1(compositor->m_display, version)
|
||||
, m_version(version)
|
||||
{}
|
||||
~PrimarySelectionDeviceManagerV1() override
|
||||
{
|
||||
qDeleteAll(m_devices);
|
||||
}
|
||||
bool isClean() override
|
||||
{
|
||||
for (auto *device : std::as_const(m_devices)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user