https://bugs.kde.org/show_bug.cgi?id=504983
Bug ID: 504983 Summary: KWin Scripting API - Crash when Assigning Window::desktops to Array of Strings instead of Array of KWin::VirtualDesktop* Classification: Plasma Product: kwin Version First 6.3.5 Reported In: Platform: openSUSE OS: Linux Status: REPORTED Keywords: drkonqi Severity: crash Priority: NOR Component: general Assignee: kwin-bugs-n...@kde.org Reporter: stellarpo...@googlemail.com Target Milestone: --- Application: kwin_wayland (6.3.5) ApplicationNotResponding [ANR]: false Qt Version: 6.9.0 Frameworks Version: 6.13.0 Operating System: Linux 6.14.6-1.0.4.sr20250501-default x86_64 Windowing System: Wayland Distribution: "openSUSE Tumbleweed-Slowroll" DrKonqi: 6.3.5 [CoredumpBackend] -- Information about the crash: I have been working on a KWin script to combine the functionality of "Show in Activities" and "Show on Desktops" from the window actions menu into one menu, so that I can file a window away exactly where I want it in one click (plan to upload it, if anyone happens ot be interested). Whilst developing this, I accidentally assigned to the list of desktops on which a window is active from an array of strings (with the desktop name), as we do for activities, instead of an array of pointers to the exposed KWin::VirtualDesktop instances. MRE: ``Javascript var activityUUID = /* ... */ "2a96ec5f-5da8-4cc8-b92f-eeebc91287a5"; var desktop = workspace.desktops[0]; var desktopName = desktop.name; workspace.activeWindow.activities = [activityUUID] //workspace.activeWindow.desktops = [desktopName ] // Whoops workspace.activeWindow.desktops = [desktop ] // This is what we meant. ``` This causes a crash in KWin (not a terrible one, as all my applications survive it), rather than the expected behaviour of some kind of typecast error being logged to journalctl and having the compositor conitnue on its merry way. I haven't looked at the source yet, but scanning the backtrace, it seems it gets reasonably far down with a null KWin::VirtualDesktop*, which to me would suggest a cast has failed but the result has not been checked somewhere before continuing. I can also reproduce it putting anything inside the array, i.e. ``Javascript workspace.activeWindow.desktops = [8008135] ``` The crash can be reproduced every time. -- Backtrace (Reduced): #5 QArrayDataPointer<char16_t>::QArrayDataPointer (this=<optimized out>, other=...) at /usr/include/qt6/QtCore/qarraydatapointer.h:37 #6 QString::QString (this=<optimized out>, other=..., this=<optimized out>, other=<optimized out>) at /usr/include/qt6/QtCore/qstring.h:1339 #7 KWin::VirtualDesktop::id (this=0x0, this=<optimized out>) at /usr/src/debug/kwin-6.3.5/src/virtualdesktops.h:47 #8 KWin::Window::setDesktops (this=0x563ca0056190, desktops=...) at /usr/src/debug/kwin-6.3.5/src/window.cpp:734 #9 0x00007f7172a63ec8 in KWin::Window::qt_static_metacall (_o=<optimized out>, _c=<optimized out>, _id=<optimized out>, _a=<optimized out>) at /usr/src/debug/kwin-6.3.5/build/src/kwin_autogen/include/moc_window.cpp:931 Reported using DrKonqi -- You are receiving this mail because: You are watching all bug changes.