dfaure added a comment.
Yes, the pitfalls are well known. 1. don't modify the container being iterated upon (from inside the loop) 2. don't use qAsConst on temporaries and for performance reasons, "don't use range-for over a non-const container", but that's of course not as bad as 1) and 2) which lead to crashes. https://www.kdab.com/goodbye-q_foreach/ has a lot of details on point 2) in the comments. REPOSITORY R241 KIO REVISION DETAIL https://phabricator.kde.org/D20489 To: mlaurent, dfaure Cc: cfeck, aacid, cgiboudeaux, kde-frameworks-devel, michaelh, ngraham, bruns