Fix orientation sensor DBus
ClosedPublic

Authored by davidedmundson on Aug 31 2019, 5:42 PM.

Details

Summary

Firstly, it was completely broken, no-one called registerObject.

Secondly deleting the adaptor doesn't really make sense, you'd still
leave the object valid, only have it broken. Docs of
QDBusAbstractAdaptor do say not to ever delete it manually.

Thirdly we don't need Q_CLASSINFO setting the DBus interface on the
exported item when we use an adaptor.

Test Plan

Manually added some setEnabled/disabled
Could now see the path

Diff Detail

Repository
R108 KWin
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
davidedmundson created this revision.Aug 31 2019, 5:42 PM
Restricted Application added a project: KWin. · View Herald TranscriptAug 31 2019, 5:42 PM
Restricted Application added a subscriber: kwin. · View Herald Transcript
davidedmundson requested review of this revision.Aug 31 2019, 5:42 PM
zzag added a subscriber: zzag.Aug 31 2019, 5:49 PM

Secondly deleting the adaptor doesn't really make sense, you'd still leave the object valid, only have it broken.

Why is that the case? (I'm a QDBus noob)

zzag accepted this revision.Aug 31 2019, 6:07 PM

According to QDBusAbstractAdaptor documentation this change makes sense.

However can you please explain why the adaptor won't be removed if you delete it?

This revision is now accepted and ready to land.Aug 31 2019, 6:07 PM
zzag added inline comments.Aug 31 2019, 6:08 PM
orientation_sensor.h
29

Delete it.

anthonyfieroni accepted this revision.Aug 31 2019, 6:13 PM
romangg accepted this revision.Aug 31 2019, 7:46 PM
romangg added a subscriber: romangg.

To be honest I don't think it's sensible trying to fix this instead of deactivating. The next problem can be just around the corner. And then we need to again have a lengthy bug hunt. To find the reason for this issue I needed at least 6 hours (ok, that was probably an outlier). The orientation sensor architecture is broken and is at best not functional and at worst hinders our other developments.

Since you have now spend the time already I won't nack it, but we can use your precious development time on other actual usable features much more Dave.

This revision was automatically updated to reflect the committed changes.

However can you please explain why the adaptor won't be removed if you delete it?

Assuming the question is "why the interface won't be removed if you remove the adaptor"?
Qt builds the object introspection when you register the object.

From a DBus POV, it is possible to do this at runtime, just not in Qt - but in either case it's slightly easier to tell if an object is available on a path than for a client and has a specific interface.

As for the crash, QDBusAdaptorConnector::addAdaptor doesn't handle the matching removal, because it'd be supporting something that wouldn't work anyway. I didn't spend too much time looking after this point.