Created attachment 169216 [details] Example script triggering a KWin crash. Grep for “potentially triggers KWin crash” to find the guilty line. Assume a handler function h() is connected to w.visibleGeometryChanged() for a particular window w in a KWin script. Accessing w.caption in h() crashes KWin when workspace.windowRemoved() was already triggered for w. The issue might be more generic, i.e., accessing a window property after workspace.windowRemoved() was triggered for this window could lead to a KWin crash in general. However, one could ask: Is it a bug of the KWin script to access windows properties of a removed window? Is it expected that KWin scripts can crash KWin (rather than just the script)? STEPS TO REPRODUCE The attached KWin script can be used to trigger a crash when a window is removed. Caution: Be prepared to being able to disable the script again to avoid repeated unwanted KWin crashes, e.g. via kwriteconfig6 --file kwinrc --group Plugins --key kwin-scripting-event-loggerEnabled false; qdbus org.kde.KWin /KWin reconfigure. OBSERVED RESULT KWin crashes. EXPECTED RESULT Nothing crashes – neither KWin nor the script. However, this is debatable (see above). SOFTWARE/OS VERSIONS Operating System: Arch Linux KDE Plasma Version: 6.0.4 KDE Frameworks Version: 6.1.0 Qt Version: 6.7.0 Kernel Version: 6.8.9-arch1-1 (64-bit) Graphics Platform: Wayland Processors: 8 × Intel® Core™ i7-4790 CPU @ 3.60GHz Memory: 23,4 GiB of RAM Graphics Processor: VERDE Manufacturer: ASUS Product Name: All Series
Created attachment 169217 [details] backtrace
After the windowRemoved signal is emitted, you MUST NOT use the window anymore, the script must drop all its references for the window. If a script holds a reference to a closed window, its lifetime won't be extended.