39 lines
1.3 KiB
Diff
39 lines
1.3 KiB
Diff
From 5ed697cda35fe300d2cb828370aaee489a0f9317 Mon Sep 17 00:00:00 2001
|
|
From: Paul Olav Tvete <paul.tvete@qt.io>
|
|
Date: Thu, 9 Jan 2020 10:28:57 +0100
|
|
Subject: [PATCH] Avoid potential double deletion
|
|
|
|
It's not safe to use qDeleteAll on lists that change when elements are
|
|
deleted.
|
|
|
|
Upstream-Status: Backport from dev branch
|
|
|
|
Change-Id: I7ec5b41da9eea839d1bda88bde621cc73a27927f
|
|
Reviewed-by: Johan Helsing <johan.helsing@qt.io>
|
|
---
|
|
src/compositor/compositor_api/qwaylandcompositor.cpp | 7 +++++--
|
|
1 file changed, 5 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/src/compositor/compositor_api/qwaylandcompositor.cpp b/src/compositor/compositor_api/qwaylandcompositor.cpp
|
|
index 5b77a3be..e021b742 100644
|
|
--- a/src/compositor/compositor_api/qwaylandcompositor.cpp
|
|
+++ b/src/compositor/compositor_api/qwaylandcompositor.cpp
|
|
@@ -236,9 +236,12 @@ void QWaylandCompositorPrivate::init()
|
|
|
|
QWaylandCompositorPrivate::~QWaylandCompositorPrivate()
|
|
{
|
|
- qDeleteAll(clients);
|
|
+ // Take copies, since the lists will get modified as elements are deleted
|
|
+ const auto clientsToDelete = clients;
|
|
+ qDeleteAll(clientsToDelete);
|
|
|
|
- qDeleteAll(outputs);
|
|
+ const auto outputsToDelete = outputs;
|
|
+ qDeleteAll(outputsToDelete);
|
|
|
|
#if QT_CONFIG(wayland_datadevice)
|
|
delete data_device_manager;
|
|
--
|
|
2.17.1
|
|
|