Bug 502940 - After update to kwin_wayland 6.3.4, workspace.stackingOrder contains references to nonexistent windows
Summary: After update to kwin_wayland 6.3.4, workspace.stackingOrder contains referenc...
Status: REPORTED
Alias: None
Product: kwin
Classification: Plasma
Component: scripting (other bugs)
Version First Reported In: 6.3.4
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2025-04-17 16:54 UTC by Pavel Urusov
Modified: 2025-04-18 17:31 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pavel Urusov 2025-04-17 16:54:35 UTC
Since the update to kwin_wayland 6.3.4, workspace.stackingOrder contains references to windows that have been closed.

This breaks some scripts that rely on workspace.stackingOrder for information about window stacking.

The issue was discovered using the following script:

const windowStack = [];
for (let i = 0; i < workspace.stackingOrder.length; i++) {
    let w = workspace.stackingOrder[i];
    if (w.resourceClass == 'plasmashell' || w.resourceClass == 'xwaylandvideobridge' ||) {
        continue;
    }
    windowStack.push(w);
}

for (let i = 0; i < windowStack.length; i++) {
    print(windowStack[i].resourceClass);
}

Viewing the output of the script using journalctl (journalctl -f QT_CATEGORY=js QT_CATEGORY=kwin_scripting), I can see that there are some references to windows that have since been closed.

SYSTEM INFORMATION

Operating System: openSUSE Tumbleweed 20250411
KDE Plasma Version: 6.3.4
KDE Frameworks Version: 6.12.0
Qt Version: 6.9.0
Kernel Version: 6.12.22-1-longterm (64-bit)
Graphics Platform: Wayland
Comment 1 Pavel Urusov 2025-04-17 17:00:23 UTC
Sorry for the typo in the script, this is the version that works:

const windowStack = [];
for (let i = 0; i < workspace.stackingOrder.length; i++) {
    let w = workspace.stackingOrder[i];
    if (w.resourceClass == 'plasmashell' || w.resourceClass == 'xwaylandvideobridge') {
        continue;
    }
    windowStack.push(w);
}

for (let i = 0; i < windowStack.length; i++) {
    print(windowStack[i].resourceClass);
}