QDirModel: replace a copy by a reference

Since we are storing pointers to the elements of the
vector thus copied, we better make sure we don't cause
it to deep-copy. The old code was fragile in that sense,
using a reference removes one layer of potential mess-ups.

Change-Id: Ib8ebbb47c2a478b5e666e767d05429700b528afd
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
This commit is contained in:
Marc Mutz 2015-11-30 14:19:39 +01:00
parent cb7d397e3d
commit bf7ce1ff84

View File

@ -168,7 +168,7 @@ void QDirModelPrivate::invalidate()
while (!nodes.empty()) {
const QDirNode *current = nodes.pop();
current->stat = false;
const QVector<QDirNode> children = current->children;
const QVector<QDirNode> &children = current->children;
for (int i = 0; i < children.count(); ++i)
nodes.push(&children.at(i));
}