https://bugs.kde.org/show_bug.cgi?id=486024
Bug ID: 486024 Summary: callDBus fails for specific number types Classification: Plasma Product: kwin Version: master Platform: Other OS: Linux Status: REPORTED Severity: normal Priority: NOR Component: scripting Assignee: kwin-bugs-n...@kde.org Reporter: kmcwilliampub...@gmail.com Target Milestone: --- SUMMARY Calling a method on a D-Bus object can fail if the method has arguments of a specific number signature, such as uint32. STEPS TO REPRODUCE 1. Monitor kwin script output: ``` journalctl -b -f | grep -i "kwin" ``` 2. Open the KWin Scripting Console 3. Call the `Inhibit` method on `org.freedesktop.Notifications`, which works as expected: ```javascript callDBus( "org.freedesktop.Notifications", "/org/freedesktop/Notifications", "org.freedesktop.Notifications", "Inhibit", "", "", {}, function (reply) { console.info("Callback. Reply: " + reply); } ); ``` 4. Check the output of the journal, which should show the message "Callback. Reply: $number" - I'll assume it was 1 for the sake of this example. Do Not Disturb should have been enabled. 5. Call the method `UnInhibit` on `org.freedesktop.Notifications`, which expects a uint32 as argument: ```javascript callDBus( "org.freedesktop.Notifications", "/org/freedesktop/Notifications", "org.freedesktop.Notifications", "UnInhibit", 1, function (reply) { console.info("UnInhibit callback. Reply: " + reply); } ); ``` OBSERVED RESULT KWin journal output shows it failed due to no method with the signature: ``` kwin_wayland[4962]: warning:kwin_scripting:unknown:0 - Received D-Bus message is error: "No such method 'UnInhibit' in interface 'org.freedesktop.Notifications' at object path '/org/freedesktop/Notifications' (signature 'i')" ``` The method `UnInhibit` expects a uint32 as argument, but callDBus is trying with an int `(signature 'i')`. EXPECTED RESULT The method `UnInhibit` should be called successfully, and Do Not Disturb should be disabled. SOFTWARE/OS VERSIONS Operating System: Fedora Linux 40 KDE Plasma Version: 6.0.3 KDE Frameworks Version: 6.0.0 Qt Version: 6.6.2 Kernel Version: 6.8.7-300.fc40.x86_64 (64-bit) Graphics Platform: Wayland Processors: 16 × AMD Ryzen 7 3700X 8-Core Processor Memory: 31.3 GiB of RAM Graphics Processor: AMD Radeon RX 580 Series Manufacturer: Micro-Star International Co., Ltd. Product Name: MS-7C56 System Version: 2.0 ADDITIONAL INFORMATION This is probably because `QJSValue::toVariant()` only converts to int or double for numbers, and special handling is needed to check for other types: https://invent.kde.org/plasma/kwin/-/blob/7949032411153ebf9d87b0e936b1bc288df12b38/src/scripting/scripting.cpp#L344 Interestingly, if `UnInhibit` is called without a callback, it fails silently. The error from kwin about the type mismatch is only output if a callback is provided. -- You are receiving this mail because: You are watching all bug changes.