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); } }