platforms/drm: handle hotplugs with disabled outputs better

If the last enabled output gets removed but we have disabled outputs
still connected, enable the first disabled output to prevent a crash.

BUG: 442990
This commit is contained in:
Xaver Hugl 2021-10-02 15:23:24 +02:00
parent 85fb0e7c43
commit 178e69b39b

View file

@ -332,6 +332,14 @@ void DrmBackend::removeOutput(DrmAbstractOutput *o)
m_placeHolderOutput->renderLoop()->inhibit();
}
if (m_enabledOutputs.contains(o)) {
if (m_enabledOutputs.count() == 1) {
for (const auto &output : qAsConst(m_outputs)) {
if (output != o) {
output->setEnabled(true);
break;
}
}
}
m_enabledOutputs.removeOne(o);
Q_EMIT outputDisabled(o);
}