[Fstab] Do not emit deviceAdded twice on fstab/mtab changes
ClosedPublic

Authored by bruns on Apr 12 2020, 6:23 PM.

Details

Summary

The deviceAdded signal was emitted twice, once with the old device list
in m_deviceList, once with the new one.

The first one is actually wrong and was fixed in kdelibs4 by moving the
deviceAdded signal after the m_deviceList update. In KF5, the second
signal was added but the first one never removed.

Move the m_deviceList update to the top (though for deviceRemoved it
does not matter much), and remove the second signal.

Depends on D28779

Test Plan
  1. solid-hardware listen
  2. add an entry to the fstab

-> deviceAdded is only emitted once

Diff Detail

Repository
R245 Solid
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
bruns created this revision.Apr 12 2020, 6:23 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptApr 12 2020, 6:23 PM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
bruns requested review of this revision.Apr 12 2020, 6:23 PM
apol accepted this revision.Apr 12 2020, 8:40 PM
apol added a subscriber: apol.
apol added inline comments.
src/solid/devices/backends/fstab/fstabmanager.cpp
122 ↗(On Diff #79955)

The debug seems wrong and probably unnecessary. I'd remove it.

This revision is now accepted and ready to land.Apr 12 2020, 8:40 PM
bruns added inline comments.Apr 12 2020, 9:09 PM
src/solid/devices/backends/fstab/fstabmanager.cpp
122 ↗(On Diff #79955)

What do you think is wrong with it?

And its the only debug output there is on this level, and always having to add debug statements in case of errors and then recompile it to get some traces is quite suboptimal. You can't ask a regular user to do it, and its silent by default.

This revision was automatically updated to reflect the committed changes.