Bug 311896 - callDBus always fails for methods with signature containing array of strings
Summary: callDBus always fails for methods with signature containing array of strings
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: scripting (show other bugs)
Version: 4.9.4
Platform: Other Linux
: NOR normal
Target Milestone: 4.10
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-12-18 18:40 UTC by Jan Palus
Modified: 2013-01-17 08:31 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In: 4.10


Attachments
Simple fix for string arrays (906 bytes, patch)
2012-12-18 18:41 UTC, Jan Palus
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Palus 2012-12-18 18:40:59 UTC
All method arguments passed to callDBus represented by QScriptValue are simply converted to QVariant with QScriptValue.toVariant(). In case of arrays such call results in array of variants. If service declares method signature explicitly and expects array of strings then call will be rejected by message bus. Perfect solution would probably require checking of both method signature and QScriptValue type and do the proper casting, but for quick solution it is safe to assume we prefer array of strings instead of array of variants. See attachment for fix that works for me.

Reproducible: Always

Steps to Reproduce:
1. Try to call method which expects array of strings ie callDBus("org.kde.klauncher","/","org.kde.KLauncher","exec_blind","konsole",new Array())
Comment 1 Jan Palus 2012-12-18 18:41:45 UTC
Created attachment 75905 [details]
Simple fix for string arrays
Comment 2 Martin Flöser 2012-12-29 07:59:11 UTC
could you please open a review request for the patch? I totally missed the patch attached to the report, we only use review board.
Comment 3 Martin Flöser 2013-01-09 07:22:17 UTC
I just reviewed the patch - looks good to me, can go in. Do you have a push privileges? If yes, please push to 4.10 branch, if not please upload a patch exported with
git format-patch 

That will keep your ownership.
Comment 4 Martin Flöser 2013-01-17 08:31:04 UTC
Git commit 5712da0bb06ecfe86017895cbbb72cd5c5551fcd by Martin Gräßlin.
Committed on 17/01/2013 at 09:30.
Pushed by graesslin into branch 'KDE/4.10'.

Support arrays in callDBus method of KWin Scripting

Thanks to Jan Palus for providing the patch.
FIXED-IN: 4.10

M  +6    -1    kwin/scripting/scripting.cpp

http://commits.kde.org/kde-workspace/5712da0bb06ecfe86017895cbbb72cd5c5551fcd