Don't assume initialized if there are pending dbus replies
ClosedPublic

Authored by elvisangelaccio on Feb 21 2017, 1:58 PM.

Details

Summary

ConnectionEditorBase::initialize() does not count the number of pending dbus
replies, so it is currently assuming that if control reaches the end of the
function, we are not waiting for secrets and we can claim the kcm is
initialized. That is not necessarily true, as bug #376739 shows.

If we count the number of replies actually received, we can be sure that there
are no more pending replies and we can then set m_initialized to true at the
end of initialize().

BUG: 376739
FIXED-IN: 5.9.3

Test Plan

Open Connection KCM from systemsettings5, no longer had the Apply button
enabled. Playing with the KCM still enables the Apply button if something is
changed.

Diff Detail

Repository
R116 Plasma Network Management Applet
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
Restricted Application added a project: Plasma. · View Herald TranscriptFeb 21 2017, 1:58 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
jgrulich edited edge metadata.Feb 21 2017, 2:07 PM

If secrets are requested then it should immediately return from initialize() and given that the kcm is not marked as initialized until we get reply. To me it appears that what you did shouldn't be necessary.

If secrets are requested then it should immediately return from initialize() and given that the kcm is not marked as initialized until we get reply. To me it appears that what you did shouldn't be necessary.

initalize() can be called more than once though, this is what happens for me:

  • initialized() is called, secrets are requested
  • setConnection() is called, resets to uninitialized
  • initialized() is called again by setConnection(), requests secrets a 2nd time
  • first reply is received
  • setConnection() is called again, which calls initialize() which sets m_initialized to true (this is what causes the bug)
  • second reply is received
jgrulich accepted this revision.Feb 22 2017, 6:23 AM

Ok, I see that this can probably happen when switching connections before secrets are actually received. Thanks for the patch!!.

This revision is now accepted and ready to land.Feb 22 2017, 6:23 AM
This revision was automatically updated to reflect the committed changes.