Commit 5611c905 authored by Xaver Hugl's avatar Xaver Hugl
Browse files

platforms/drm: fix gpu removal

As soon as m_backends.removeOne(*it) returns, "it" no longer
points to the same value.

CCBUG: 441372


(cherry picked from commit fbff8636)
parent 99b603af
......@@ -152,12 +152,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);
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment