https://bugs.kde.org/show_bug.cgi?id=528228

            Bug ID: 528228
           Summary: Panel hangs in childAtCoordinates() while something is
                    dragged over it when the layout spacing is 0
    Classification: Plasma
           Product: plasmashell
      Version First 6.8.2
       Reported In:
          Platform: NixOS
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: Panel
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: 1.0

plasmashell's main thread hangs at full CPU while something is dragged over a
horizontal panel whose layout has a rowSpacing of 0. On 2026-10-28 it answered
no D-Bus call for 25 s, and `systemctl --user restart plasma-plasmashell` ended
it. The spacing is 0 on my panel because the third-party Panel Colorizer widget
sets the panel's widget spacing to 0; the stock panel uses
Kirigami.Units.smallSpacing.

In containments/panel/LayoutManager.js, childAtCoordinates() steps x back by
layout.rowSpacing (y by columnSpacing on a vertical panel) until
layout.childAt() finds a widget. With a spacing of 0, x never changes, so the
loop never ends when no widget is under the start point. The function is the
same on master.

To check the function on its own, I ran master's LayoutManager.js in Node 24
with a mocked layout that has one widget from x 0 to 200, and asked for the
child at x 300:

```
import { readFileSync } from "node:fs";
const src = readFileSync(process.argv[2], "utf8");
for (const spacing of [4, 0]) {
  let calls = 0;
  const layout = {
    width: 500, height: 30, rowSpacing: spacing, columnSpacing: spacing,
    childAt(x, y) {
      if (++calls > 1e7) throw new Error(`still looping after 1e7 childAt
calls, x=${x}`);
      return x < 200 ? { index: 0, x: 0, width: 200 } : null;
    },
  };
  const root = { isHorizontal: true };
  const childAtCoordinates = new Function("root", "layout", `${src}; return
childAtCoordinates;`)(root, layout);
  try {
    const child = childAtCoordinates(300, 10);
    console.log(`rowSpacing ${spacing}: returned the widget with index
${child.index} after ${calls} childAt calls`);
  } catch (e) {
    console.log(`rowSpacing ${spacing}: ${e.message}`);
  }
}
```

It printed:

```
rowSpacing 4: returned the widget with index 0 after 27 childAt calls
rowSpacing 0: still looping after 1e7 childAt calls, x=300
```

Should the search step at least 1 px, or is a spacing of 0 not supported on the
panel layout? I patch it locally to step by max(1, spacing) and to start no
further out than the end of the last widget.

NixOS 26.11, Plasma 6.8.2, Frameworks 6.31.0, Qt 6.12.0, Wayland.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to