From kde-core-devel Thu Jan 03 18:09:25 2013 From: David Edmundson Date: Thu, 03 Jan 2013 18:09:25 +0000 To: kde-core-devel Subject: Re: Kded and DBus Message-Id: X-MARC-Message: https://marc.info/?l=kde-core-devel&m=135723657927280 On Thu, Jan 3, 2013 at 4:43 PM, Daniel Nicoletti wrote= : > It's a known issue, we ha random code running on the same thread.. A wo= rk > around is to put the code on a thread, and make sure all your call are n= on > blocking. > I'm planing on doing a prof of concept to change the way kded works to ha= ve > this and other problems gone. > > Best > > Em 03/01/2013 14:14, "Cedric Bellegarde" 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 ? A= m >> i >> missing something ? >> >> regards, >> -- >> C=E9dric Always use async calls for everything We had this lock between KTp and Amarok https://bugs.kde.org/show_bug.cgi?id=3D310826 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 =3D QDBusConnection::sessionBus().interface()->asyncCall(QLatin1String("ListNam= es")); QDBusPendingCallWatcher *callWatcher =3D new QDBusPendingCallWatcher(async, this); connect(callWatcher, SIGNAL(finished(QDBusPendingCallWatcher*)), this, SLOT(serviceNameFetchFinished(QDBusPendingCallWatcher*)))= ;