[kio] src/filewidgets: Use QVector instead of QSet as Kévin suggested to help with QSet ordering unstability.

David Faure faure at kde.org
Thu Aug 13 20:49:45 UTC 2015


On Sunday 09 August 2015 17:41:16 Kevin Ottens wrote:
> On Sunday 09 August 2015 00:04:16 David Faure wrote:
> > On Saturday 08 August 2015 21:38:10 David Faure wrote:
> > > Git commit 4ce4fbe22fdb385f6c07acfd746b31362a4d5d8a by David Faure.
> > > Committed on 08/08/2015 at 21:37.
> > > Pushed by dfaure into branch 'master'.
> > > 
> > > Use QVector instead of QSet as Kévin suggested to help with QSet ordering
> > > unstability.
> > !@*&$ still fails.
> > 
> > https://build.kde.org/job/kio%20master%20stable-kf5-qt5/PLATFORM=Linux,compi
> > ler=gcc/48/testReport/%28root%29/TestSuite/kiofilewidgets_kfileplacesmodelte
> > st/
> > 
> > (but passes in kio master kf5-qt5, either it's unstable or the Qt version
> > (5.4 vs 5.5) matters)
> 
> Means there's some other QSet/QHash involved somewhere while the test runs 
> then? I don't see why the order would be different in a QVector between 5.4 
> and 5.5 otherwise.

Found it, the QSet which makes ordering inconsistent is inside Solid.

solid/src/solid/devices/frontend/devicemanager.cpp says
141├>            QSet<DeviceInterface::Type> supportedTypes = backend->supportedInterfaces();
142│             if (supportedTypes.intersect(usedTypes).isEmpty()) {
143│                 continue;
144│             }
145│
146│             Q_FOREACH (DeviceInterface::Type type, supportedTypes) {
147│                 udis += QSet<QString>::fromList(backend->devicesFromQuery(parentUdi, type));
148│             }

I thought this would impact the ordering seen by users, so I made it stable by adding
a std::sort. Patch for review: http://www.davidfaure.fr/2015/solid_ordering.diff

But now I see that this doesn't actually affect users, at least with KFilePlacesModel, 
since it's apparently possible to reorder devices there and it gets remembered
(looks like the solid query results gets stored into the bookmarks file - not sure how
that works with appending/removing devices later on though).

So maybe the sorting should only be done in unittests, not in solid itself, if real
apps are fine with random ordering?

Input welcome.

PS: who's the Solid maintainer? I thought I heard that was Lukáš, but the yaml file says afiestas.

-- 
David Faure, faure at kde.org, http://www.davidfaure.fr
Working on KDE Frameworks 5
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 173 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20150813/9a580618/attachment.sig>


More information about the Kde-frameworks-devel mailing list