From 178e69b39b7c7ccc4e3d9f4ea85b2fde15eeac2a Mon Sep 17 00:00:00 2001 From: Xaver Hugl Date: Sat, 2 Oct 2021 15:23:24 +0200 Subject: [PATCH] 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 --- src/plugins/platforms/drm/drm_backend.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/plugins/platforms/drm/drm_backend.cpp b/src/plugins/platforms/drm/drm_backend.cpp index 372fba22c1..a99b720177 100644 --- a/src/plugins/platforms/drm/drm_backend.cpp +++ b/src/plugins/platforms/drm/drm_backend.cpp @@ -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); }