From fbff8636b9a1d21772fccaacb8b2a55aa517aa90 Mon Sep 17 00:00:00 2001 From: Xaver Hugl Date: Mon, 23 Aug 2021 23:22:28 +0200 Subject: [PATCH] platforms/drm: fix gpu removal As soon as m_backends.removeOne(*it) returns, "it" no longer points to the same value. CCBUG: 441372 --- src/plugins/platforms/drm/egl_multi_backend.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/drm/egl_multi_backend.cpp b/src/plugins/platforms/drm/egl_multi_backend.cpp index 5888659785..adbe7d44fc 100644 --- a/src/plugins/platforms/drm/egl_multi_backend.cpp +++ b/src/plugins/platforms/drm/egl_multi_backend.cpp @@ -151,12 +151,12 @@ void EglMultiBackend::addGpu(DrmGpu *gpu) void EglMultiBackend::removeGpu(DrmGpu *gpu) { - auto it = std::find_if(m_backends.constBegin(), m_backends.constEnd(), [gpu](auto backend) { + auto it = std::find_if(m_backends.begin(), m_backends.end(), [gpu](const auto &backend) { return backend->gpu() == gpu; }); - if (it != m_backends.constEnd()) { - m_backends.removeOne(*it); + if (it != m_backends.end()) { delete *it; + m_backends.erase(it); } }