SUMMARY When a window is assigned the “maximizedAboutToChange” signal in a KWin script and triggers the event when maximized, in certain cases, specifically when the window is in “MaximizeMode.MaximizeFull,” kwin crashes. STEPS TO REPRODUCE 1. Create a KWin script 2. Add `maximizedAboutToChange` signal to any window 3. Trigger event (maximize window) OBSERVED RESULT KWin crashes EXPECTED RESULT No crash SOFTWARE/OS VERSIONS KDE Plasma Version: 6.5.4 ADDITIONAL INFORMATION Log: ``` kwin_wayland[1649087]: "onWindowMaximizedStateChanged@:99" kwin_wayland[1649087]: <Unknown File>:99: TypeError: Passing incompatible arguments to C++ functions from JavaScript is not allowed. ```
More info https://codeberg.org/Serroda/fluid-tile/issues/30 This could be the problem https://invent.kde.org/plasma/kwin/-/blame/master/src/effect/globals.h#L61
```js workspace.windowAdded.connect(window => { window.maximizedAboutToChange.connect(mode => console.log("whatsup", mode)); }); ``` works for me ``` js: whatsup 3 js: whatsup 0 ``` can you attach a simple script to the bug report that reproduces the issue?
The error occurs occasionally. I can't tell you exactly when it happens; it just shows the error in the log. ```js window.maximizedAboutToChange.connect((mode) => { onMaximizeChange(mode, window); }); } function onMaximizeChange(mode, window) { if (mode !== 0) { return; } //DO STUFF } ```
Maybe the `window` object is not valid or something? If kwin crashes, can you share a backtrace please?
More logs ``` Dec 16 02:04:35 kwin_wayland[1649087]: QDBusConnection: couldn't handle call to Teardown, no slot matched Dec 16 02:04:35 kwin_wayland[1649087]: Could not find slot Krunner1Adaptor::Teardown Dec 16 02:05:45 kwin_wayland[1649087]: "Could not convert argument 0 from undefined to QList<qulonglong>" Dec 16 02:05:45 kwin_wayland[1649087]: "onWindowMaximizedStateChanged@:99" Dec 16 02:05:45 kwin_wayland[1649087]: <Unknown File>:99: TypeError: Passing incompatible arguments to C++ functions from JavaScript is not allowed. ``` `MaximizeMode` was `undefined` - "Could not convert argument 0 from undefined to QList<qulonglong>" `Window` object is valid and not `undefined` This only happens in specific cases, when the window changes state to maximized but does not return a `mode`
Ok nevermind is a problem with my code, `maximizedAboutToChange` is working Sorry!