Control: found -1 4:6.3.6-1+deb13u1
Control: fixed -1 4:6.5.1-1

Hi,

I have been facing what looks like the same issue for several months.
Since the 28th of September, I have been running a patched version of
kwin with commit 63edb977 (kde#495702) as mentioned by Max.
Before reporting, I wanted to be sure that the mentioned fix fixed my issue
and it does.

Setup: Lenovo ThinkPad T14, AMD Radeon 840M/860M, Plasma 6.3.6
on Wayland, internal LCD + external HDMI monitor.
The trigger is the HDMI monitor going to deep sleep (or waking up) while the 
session
is locked.

1. kde#495702 (this bug): dangling Workspace active output. Crash in
   the Alt+Tab switcher QML binding after the output has been freed
   (backtrace from 2026-09-28, stock 4:6.3.6-1):

     #5  KWin::OutputMode::size (this=0x45705572f77077) at 
./src/core/output.cpp:54
     #8  KWin::Output::geometry (this=0x55c8ad7868d0) at 
./src/core/output.cpp:459
     #9  KWin::TabBox::SwitcherItem::screenGeometry () at 
./src/tabbox/switcheritem.cpp:74
         ... QML binding re-evaluation from
         KWin::Workspace::updateOutputs() <- DrmBackend::handleUdevEvent()

2. kde#504959 (#1147212, fixed in 13.8), on 2026-11-20 with a build
   that had 63edb977 but not the ColorManagementOutputV1 patches:

     #5  KWin::ColorManagementOutputV1::ColorManagementOutputV1(...)
         at ./src/wayland/colormanagement_v1.cpp:580
         ... wl_event_loop_dispatch() <- KWin::Display::dispatchEvents()

Following up on Bernhard's message: the 13.8 update (4:6.3.6-1+deb13u1,
#1150067) only adds the two ColorManagementOutputV1 patches (172f8f2e,
e1fd647b, kde#504959). It does not include 63edb977 (kde#495702), so
this bug is still present in trixie. They are two different crashes
with the same trigger (an output going away), and I have hit both on
the same machine.

Counted from the journal: screen locks, the locks during which the
HDMI monitor dropped off or came back, and kwin_wayland crashes.

  Stock 4:6.3.6-1, 2026-05-29 to 2026-09-28:
    651 locks, 45 with the HDMI monitor sleeping/waking while locked
    5 with kwin_wayland crashing, each 8 s after an HDMI event

  4:6.3.6-1 + 63edb977, 2026-09-28 to 2026-11-30 (2 months):
    343 locks, 33 with the HDMI monitor sleeping/waking while locked
    1 crash: the ColorManagementOutputV1 one above

So both fixes are needed, and 63edb977 has fixed this bug for me.

Attached is a debdiff against 4:6.3.6-1+deb13u1: the upstream
Plasma/6.4 commit 63edb977 as a quilt patch, the series line and a
changelog entry. Notes:

 - 63edb977 applies on top of 4:6.3.6-1+deb13u1 with offsets only
   (hunks at 1229 and 2176, no fuzz). Only the src/workspace.cpp part
   is included: the autotest part depends on tests added upstream
   after 6.3 (commit 1d86181d "autotests: Add active output tests").
   This is recorded in the patch's DEP-3 header.
 - The version 4:6.3.6-1+deb13u1+hotplugfix1 is just my local one.
 - I have now built that combined package (13.8 + 63edb977) and
   installed it on the same machine, and will report back if
   anything goes wrong.

Could 63edb977 be considered for the next trixie point release?

I used an AI assistant (Claude) to help analyse the backtraces, prepare the
debdiff and draft this message. I reviewed everything, and the backtraces
and test results come from my own machine.

Thanks,
Romain Reignier
diff -Nru kwin-6.3.6/debian/changelog kwin-6.3.6/debian/changelog
--- kwin-6.3.6/debian/changelog 2026-10-05 15:25:07.000000000 +0200
+++ kwin-6.3.6/debian/changelog 2026-11-30 16:30:47.000000000 +0100
@@ -1,3 +1,11 @@
+kwin (4:6.3.6-1+deb13u1+hotplugfix1) trixie; urgency=medium
+
+  * Backport upstream commit 63edb977 to fix a compositor crash
+    (dangling active output) when an output is removed, e.g. monitor
+    sleep or dock unplug (KDE #495702). (Closes: #1143050)
+
+ -- Romain Reignier <[email protected]>  Mon, 30 Nov 2026 16:30:47 +0100
+
 kwin (4:6.3.6-1+deb13u1) trixie; urgency=medium
 
   [ Sandro Knauß ]
diff -Nru kwin-6.3.6/debian/patches/series kwin-6.3.6/debian/patches/series
--- kwin-6.3.6/debian/patches/series    2026-10-05 15:24:33.000000000 +0200
+++ kwin-6.3.6/debian/patches/series    2026-11-30 16:30:46.000000000 +0100
@@ -25,3 +25,4 @@
 upstream_267fa4ec_Fix-activate-and-raise-action-with-panels.patch
 upstream_e1fd647b_wayland-Make-ColorManagementOutputV1-handle-output-r.patch
 upstream_172f8f2e_wayland-Check-for-nullptr-output-in-ColorManagemen.patch
+upstream_63edb977_Fix-Workspace-activateNextWindow-corrupting-active-output-on-hotplug.patch
diff -Nru 
kwin-6.3.6/debian/patches/upstream_63edb977_Fix-Workspace-activateNextWindow-corrupting-active-output-on-hotplug.patch
 
kwin-6.3.6/debian/patches/upstream_63edb977_Fix-Workspace-activateNextWindow-corrupting-active-output-on-hotplug.patch
--- 
kwin-6.3.6/debian/patches/upstream_63edb977_Fix-Workspace-activateNextWindow-corrupting-active-output-on-hotplug.patch
      1970-01-01 01:00:00.000000000 +0100
+++ 
kwin-6.3.6/debian/patches/upstream_63edb977_Fix-Workspace-activateNextWindow-corrupting-active-output-on-hotplug.patch
      2026-11-30 16:30:46.000000000 +0100
@@ -0,0 +1,54 @@
+From 63edb977e99a860a5a167e210e6222a24115c593 Mon Sep 17 00:00:00 2001
+From: Vlad Zahorodnii <[email protected]>
+Date: Mon, 20 Oct 2025 12:36:54 +0300
+Subject: [PATCH] Fix Workspace::activateNextWindow() corrupting active output
+ on hotplug
+
+After 4ee32d7f71de7f7f9a24c44b9dc4dd31fd3be98f, layer shell windows are
+removed when the Workspace::outputRemoved() signal is emitted.
+
+The side-effect of that change is that the activateNextWindow() may be
+called when the Workspace::outputRemoved() signal is emitted.
+
+The activateNextWindow() function is interesting because it can set the
+active output to the one of the Window.
+
+If the next candidate window is on a just removed output, the Workspace
+can end up with a dangling active output.
+
+To prevent that case, this change moves active output cleanup code so it
+is after the outputRemoved() signal is emitted and after windows are
+re-arranged.
+
+BUG: 495702
+(cherry picked from commit 5aa070d5f4a4c0ce1802aa94eec6ebf9bc9edca9)
+
+Origin: upstream, 
https://invent.kde.org/plasma/kwin/-/commit/63edb977e99a860a5a167e210e6222a24115c593
+Bug: https://bugs.kde.org/show_bug.cgi?id=495702
+Bug-Debian: https://bugs.debian.org/1143050
+Note: autotest hunk dropped for 6.3.6, it depends on tests added after 6.3.
+---
+diff --git a/src/workspace.cpp b/src/workspace.cpp
+index 0283608c890..dcef3a57f44 100644
+--- a/src/workspace.cpp
++++ b/src/workspace.cpp
+@@ -1166,7 +1166,7 @@ void Workspace::updateOutputs(const 
std::optional<QList<Output *>> &outputOrder)
+         }
+     }
+ 
+-    if (!m_activeOutput || !m_outputs.contains(m_activeOutput)) {
++    if (!m_activeOutput) {
+         setActiveOutput(m_outputs[0]);
+     }
+ 
+@@ -2084,6 +2084,10 @@ void Workspace::desktopResized()
+ 
+     rearrange();
+ 
++    if (!m_outputs.contains(m_activeOutput)) {
++        setActiveOutput(m_outputs[0]);
++    }
++
+     const auto stack = stackingOrder();
+     for (Window *window : stack) {
+         
window->setMoveResizeOutput(outputAt(window->moveResizeGeometry().center()));

Reply via email to