Drm backend: delete DrmOutput* after DrmScreens notified its users

Test:

Plug-in and out HDMI screen

Before:
Crash when pluggin-in
After:
No crash
master
Méven Car 2020-05-19 10:55:14 +02:00
parent be245e2f8b
commit b77d29119e
1 changed files with 3 additions and 1 deletions

View File

@ -424,6 +424,7 @@ bool DrmBackend::updateOutputs()
}
// check for outputs which got removed
QVector<DrmOutput*> removedOutputs;
auto it = m_outputs.begin();
while (it != m_outputs.end()) {
if (connectedOutputs.contains(*it)) {
@ -434,7 +435,7 @@ bool DrmBackend::updateOutputs()
it = m_outputs.erase(it);
m_enabledOutputs.removeOne(removed);
emit outputRemoved(removed);
removed->teardown();
removedOutputs.append(removed);
}
// now check new connections
@ -518,6 +519,7 @@ bool DrmBackend::updateOutputs()
emit screensQueried();
}
qDeleteAll(removedOutputs);
qDeleteAll(oldConnectors);
qDeleteAll(oldCrtcs);
return true;