backends/drm: don't read configuration of zero outputs

Doesn't make any sense and can cause crashes
This commit is contained in:
Xaver Hugl 2022-01-19 15:31:11 +01:00
parent d67a0b006a
commit b0173c236c

View file

@ -434,6 +434,7 @@ namespace KWinKScreenIntegration
bool DrmBackend::readOutputsConfiguration(const QVector<DrmAbstractOutput*> &outputs) bool DrmBackend::readOutputsConfiguration(const QVector<DrmAbstractOutput*> &outputs)
{ {
Q_ASSERT(!outputs.isEmpty());
const auto outputsInfo = KWinKScreenIntegration::outputsConfig(outputs); const auto outputsInfo = KWinKScreenIntegration::outputsConfig(outputs);
AbstractWaylandOutput *primaryOutput = outputs.constFirst(); AbstractWaylandOutput *primaryOutput = outputs.constFirst();
@ -510,7 +511,7 @@ void DrmBackend::enableOutput(DrmAbstractOutput *output, bool enable)
m_placeHolderOutput = nullptr; m_placeHolderOutput = nullptr;
} }
} else { } else {
if (m_enabledOutputs.count() == 1) { if (m_enabledOutputs.count() == 1 && m_outputs.count() > 1) {
auto outputs = m_outputs; auto outputs = m_outputs;
outputs.removeOne(output); outputs.removeOne(output);
if (!readOutputsConfiguration(outputs)) { if (!readOutputsConfiguration(outputs)) {