There is a slight time frame (~2ms) where mount has returned but the MountPoints property is not updated. When the mounpoint is queried during that time it will be empty and opening a plugged in USB device in Dolphin will fail.
To avoid this use the mountpoint information returned by the mount() call
Details
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.
src/solid/devices/backends/udisks2/udisksstorageaccess.cpp | ||
---|---|---|
35 | Initialization not needed for complex types | |
82 | Won't this bypass the luks stuff when it is not mounted or something? | |
151 | Coding style: if (!...) { | |
200 | Don't you need to clear the m_mountPoint after unmount? |
This approach is completely wrong.
The right approach is to wait for the information in a PropertiesChanged signal, and only when the mountpoint has been set in the property propage the signal.
This whole "our information is inconsistent, lets query for it explicitly" dance is a mess.
They key issue is that the PropertiesChanged signal hasn't been emitted by the time filePath() is called. We could wait for the signal there, but we don't need to since we already get the same information from the mount() call, but we just didn't use it before. That won't work if the drive is already mounted by the time solid is started, so we query the mountPoints property in that case, but that is no different to the old code.