From c899cd07f82377dd545a01c85934389554170f2a Mon Sep 17 00:00:00 2001 From: Aleix Pol Gonzalez Date: Tue, 17 Oct 2023 18:10:37 +0200 Subject: [PATCH] xwayland: Do not set scale to 0 It would be the case upon lid close which would make KWin crash. Also adds an assert so in case it happened again we would be able to catch it easily. It gets applied asynchronously so it needs to be chased down. --- src/main.cpp | 1 + src/wayland/clientconnection.cpp | 1 + src/workspace.cpp | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 42ff3958b4..65c71b9ea5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -381,6 +381,7 @@ static X11EventFilterContainer *takeEventFilter(X11EventFilter *eventFilter, void Application::setXwaylandScale(qreal scale) { + Q_ASSERT(scale != 0); if (scale != m_xwaylandScale) { m_xwaylandScale = scale; // change the font dpi to match diff --git a/src/wayland/clientconnection.cpp b/src/wayland/clientconnection.cpp index dcd839f4a8..98e6382f0b 100644 --- a/src/wayland/clientconnection.cpp +++ b/src/wayland/clientconnection.cpp @@ -155,6 +155,7 @@ QString ClientConnection::executablePath() const void ClientConnection::setScaleOverride(qreal scaleOveride) { + Q_ASSERT(scaleOveride != 0); d->scaleOverride = scaleOveride; Q_EMIT scaleOverrideChanged(); } diff --git a/src/workspace.cpp b/src/workspace.cpp index ae7e8208db..e1ed446dfa 100644 --- a/src/workspace.cpp +++ b/src/workspace.cpp @@ -477,7 +477,7 @@ bool Workspace::applyOutputConfiguration(const OutputConfiguration &config, cons KConfig cfg(QStringLiteral("kdeglobals")); KConfigGroup kscreenGroup = cfg.group("KScreen"); const bool xwaylandClientsScale = kscreenGroup.readEntry("XwaylandClientsScale", true); - if (xwaylandClientsScale) { + if (xwaylandClientsScale && !outputOrder.isEmpty()) { double maxScale = 0; for (Output *output : outputOrder) { const auto changeset = config.constChangeSet(output);