Kded and DBus

David Edmundson david at davidedmundson.co.uk
Thu Jan 3 18:09:25 GMT 2013


On Thu, Jan 3, 2013 at 4:43 PM, Daniel Nicoletti <dantti12 at gmail.com> wrote:
> It's a known issue,  we ha random code running on the same thread..  A work
> around is to put the code on a thread,  and make sure all your call are non
> blocking.
> I'm planing on doing a prof of concept to change the way kded works to have
> this and other problems gone.
>
> Best
>
> Em 03/01/2013 14:14, "Cedric Bellegarde" <gnumdk at gmail.com> escreveu:
>
>> Hello,
>>
>> i'm kded-appmenu maintainer and i've got issues with Kded and DBus...
>>
>> When appmenu support is enabled, some applications hangs on startup: VLC,
>> Clementine.
>>
>> After some investigations,  and using clementine as an exemple, this is
>> happening:
>>
>> kded (kmix) do a DBus Introspection on clementine while clementine do a
>> DBus
>> Introspection on kded (appmenu).
>>
>> This make kded and the applications hangs for a while.
>>
>> Any idea to fix this ? Is this a kded limitation ? A DBus limitation ? Am
>> i
>> missing something ?
>>
>> regards,
>> --
>> Cédric

Always use async calls for everything

We had this lock between KTp and Amarok
https://bugs.kde.org/show_bug.cgi?id=310826 in exactly the same way.
Which is resolved now.

One problem is that
QDBusConnection::sessionBus().interface()->registeredServiceNames() is
a synchronous dbus call, which isn't easy to spot, and Qt has no async
alternative built in.

Mixer_MPRIS2::addAllRunningPlayersAndInitHotplug() uses this.


Fortunately one can recreate it asynchronously like so:

QDBusPendingCall async =
QDBusConnection::sessionBus().interface()->asyncCall(QLatin1String("ListNames"));
    QDBusPendingCallWatcher *callWatcher = new
QDBusPendingCallWatcher(async, this);
    connect(callWatcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
            this, SLOT(serviceNameFetchFinished(QDBusPendingCallWatcher*)));




More information about the kde-core-devel mailing list