I think the check should not warn and it should definitely not propose the wrong fix on code like this. QHash <int, MyClass*> some_hash; //... qDeleteAll(some_hash.values(some_key)) Just the call without arguments should be flaged: qDeleteAll(some_hash.values()) Reproducible: Always
I'll fix the warning message but not remove it. hash.values(key), just like hash.values() will malloc to create a temporary list hash.values(key) is a bit more cumbersome for you to fix though, you'd have to write a for loop. So I've added QHash::equal_range(key), which will be available in Qt 5.7.
Git commit 53963579d6cc4410cb414302b23772837d8577e1 by Sergio Martins. Committed on 08/04/2016 at 16:33. Pushed by smartins into branch 'master'. qdeleteall: Fix warning when using the values(key) overload M +6 -1 checks/qdeleteall.cpp M +2 -0 tests/qdeleteall/main.cpp M +1 -0 tests/qdeleteall/main.cpp.expected http://commits.kde.org/clazy/53963579d6cc4410cb414302b23772837d8577e1