Running queries via dbus

Alex Merry kde at randomguy3.me.uk
Tue Mar 23 22:55:08 CET 2010


CC'ing plasma-devel, since this is an important point regarding runners that 
use D-Bus.  Please keep any discussion on this issue at plasma-devel.

On Tuesday 23 March 2010 17:26:54 Alex Merry wrote:
> On Monday 22 March 2010 22:05:26 Jacopo De Simoi wrote:
> > > In particular, Meta::Track has float as the return type of bpm().
> > > Perhaps it would be sensible to make this a qreal?  Also, score()
> > > should probably also return qreal (rather than double) for
> > > consistency.
> > 
> > Probably qreal would be the better choice; would it be possible to change
> > it only when using dbus, to minimize interference with other parts of the
> > code? As far as I can tell this issue makes the dbus query interface
> > basically useless in most cases.
> 
> Well, yes, but it would be cleaner to just use qreal everywhere.

Right, committed this - it will be in the next release of Amarok.

BUT the main issue over the freezing interface is that the audioplayercontrol 
runner is using synchronous D-Bus calls (QDBusConnection::call).  This not 
only blocks the calling thread, but the main thread as well (since that's 
where the D-Bus call actually happens).

Instead, you should use QDBusConnection::asyncCall.  This can be used in 
exactly the same way (implicit casting FTW), and casting to a QDBusReply will 
cause the calling thread to block as you would expect.  But, importantly, it 
WON'T cause the main thread to block.

Alternatively, you can pass QDBus::BlockWithGui as an argument to 
QDBusConnection::call.

I'll commit this change to audioplayercontrol to trunk.  Should I also 
backport it?

Alex



-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/plasma-devel/attachments/20100323/25c6fa18/attachment.sig 


More information about the Plasma-devel mailing list