backends/drm: Fix potential use-after-free
When the output is removed, there are legit cases when the connector can be still accessed. CCBUG: 457002
This commit is contained in:
parent
f0d59b078b
commit
5aef41663a
1 changed files with 1 additions and 1 deletions
|
@ -313,12 +313,12 @@ bool DrmGpu::updateOutputs()
|
||||||
pipeline->revertPendingChanges();
|
pipeline->revertPendingChanges();
|
||||||
}
|
}
|
||||||
for (const auto &output : qAsConst(addedOutputs)) {
|
for (const auto &output : qAsConst(addedOutputs)) {
|
||||||
|
removeOutput(output);
|
||||||
const auto it = std::find_if(m_connectors.begin(), m_connectors.end(), [output](const auto &conn) {
|
const auto it = std::find_if(m_connectors.begin(), m_connectors.end(), [output](const auto &conn) {
|
||||||
return conn.get() == output->connector();
|
return conn.get() == output->connector();
|
||||||
});
|
});
|
||||||
Q_ASSERT(it != m_connectors.end());
|
Q_ASSERT(it != m_connectors.end());
|
||||||
m_connectors.erase(it);
|
m_connectors.erase(it);
|
||||||
removeOutput(output);
|
|
||||||
}
|
}
|
||||||
QTimer::singleShot(50, m_platform, &DrmBackend::updateOutputs);
|
QTimer::singleShot(50, m_platform, &DrmBackend::updateOutputs);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue