--1aac54ab830d4bbd954c7f09ccd65614 Content-Type: text/plain; charset="ascii" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit davidedmundson added a comment. To expand on the DBus problem: The connection object resides in a thread; but emits stuff from the main thread. DBus is generally thread safe, but QDBusAbstractAdaptor uses sender() in relaying so isn't. add in a bouncer, things work nicely: connect(this, &Connection::deviceRemoved, this, [this](Device* device) { emit deviceRemovedSysName(device->sysName()); }); this gets implicitly queuedconnection as this is emitted in another thread and it all works. Huzzah However, we still get a tonne of warnings because we're emitting a bunch of other signals, and internally in QDBusAbstractAdaptor we have the warning about checking for threads*before* we see if actually relays the signal. The only solution I can see is to make an explicit adaptor. (or we change the KCM side to use org.freedesktop.DBus.ObjectManager and forget putting anything in here) REPOSITORY R108 KWin REVISION DETAIL https://phabricator.kde.org/D3479 EMAIL PREFERENCES https://phabricator.kde.org/settings/panel/emailpreferences/ To: subdiff, #kwin, #plasma, davidedmundson Cc: graesslin, davidedmundson, plasma-devel, kwin, #kwin, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas --1aac54ab830d4bbd954c7f09ccd65614 Content-Type: text/html; charset="ascii" Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable
davidedmundson=20added=20a=20comment. | View=20Revision
To=20expand=20on=20the=20DBus=20problem:
The=20connection=20object=20resides=20in=20a=20thread;=20but=20emits=20s=
tuff=20from=20the=20main=20thread.=20
DBus=20is=20generally=20thread=20safe,=20but=20QDBusAbstractAdaptor=20uses=
=20sender()=20in=20relaying=20so=20isn't.
add=20in=20a=20bouncer,=20things=20work=20nicely:
connect(this,=20&= Connection::deviceRemoved,=20this,=20[this](Device*=20device)=20{ =20=20=20=20=20=20=20=20=20=20emit=20deviceRemovedSysName(device->sysNam= e()); =20=20});
this=20gets=20implicitly=20queuedconnection=20as=20this=20is=20emitted= =20in=20another=20thread=20and=20it=20all=20works.=20Huzzah
However,=20we=20still=20get=20a=20tonne=20of=20warnings=20because=20we= 039;re=20emitting=20a=20bunch=20of=20other=20signals,=20and=20internally=20= in=20QDBusAbstractAdaptor=20we=20have=20the=20warning=20about=20checking=20= for=20threads*before*=20we=20see=20if=20actually=20relays=20the=20signal.= p>
The=20only=20solution=20I=20can=20see=20is=20to=20make=20an=20explicit= =20adaptor.
(or=20we=20change=20the=20KCM=20side=20to=20use=20org.freedesktop.DBus.O= bjectManager=20and=20forget=20putting=20anything=20in=20here)