Calculate KAuthAction::isValid on demand
ClosedPublic

Authored by davidedmundson on Feb 3 2020, 7:29 PM.

Details

Summary

Polkit1Backend fetches a list of /all/ actions once on startup, when we
want to see if an action is valid we compare it to this list.

Fine in principle except that if isValid() is called, we have to block
via a nested event loop to wait for the full list to be fetched.

Given we construct actions on startup and the backend on startup we
almost always hit this. It can easily time out (the case I'm debugging
here) or if it's invoked from QML it would simply crash.

Any good fix would be an API/behavioural break. (T12643)

In practice few places call isValid() at which point the cache is
fetched and we hide the problem, also we can document it.

It's not slower as the only backend that has
CheckActionExistenceCapability is a cache lookup anyway.

Test Plan

Used on a slow VM with a slow KCM
My actions started working

Diff Detail

Repository
R283 KAuth
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.Feb 3 2020, 7:29 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptFeb 3 2020, 7:29 PM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
davidedmundson requested review of this revision.Feb 3 2020, 7:29 PM
broulik accepted this revision.Feb 3 2020, 7:49 PM
This revision is now accepted and ready to land.Feb 3 2020, 7:49 PM
This revision was automatically updated to reflect the committed changes.