From b0173c236cf5a5045eac20f28caff8933a3663d6 Mon Sep 17 00:00:00 2001 From: Xaver Hugl Date: Wed, 19 Jan 2022 15:31:11 +0100 Subject: [PATCH] backends/drm: don't read configuration of zero outputs Doesn't make any sense and can cause crashes --- src/backends/drm/drm_backend.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/backends/drm/drm_backend.cpp b/src/backends/drm/drm_backend.cpp index 4d6efc69de..867a071c37 100644 --- a/src/backends/drm/drm_backend.cpp +++ b/src/backends/drm/drm_backend.cpp @@ -434,6 +434,7 @@ namespace KWinKScreenIntegration bool DrmBackend::readOutputsConfiguration(const QVector &outputs) { + Q_ASSERT(!outputs.isEmpty()); const auto outputsInfo = KWinKScreenIntegration::outputsConfig(outputs); AbstractWaylandOutput *primaryOutput = outputs.constFirst(); @@ -510,7 +511,7 @@ void DrmBackend::enableOutput(DrmAbstractOutput *output, bool enable) m_placeHolderOutput = nullptr; } } else { - if (m_enabledOutputs.count() == 1) { + if (m_enabledOutputs.count() == 1 && m_outputs.count() > 1) { auto outputs = m_outputs; outputs.removeOne(output); if (!readOutputsConfiguration(outputs)) {