Details
-
Bug
-
Resolution: Invalid
-
Not Evaluated
-
None
-
5.6.2, 5.8.0, 5.9.0 Beta 3
-
None
-
Linux
Description
See attached example.
The use case is I'm trying to find all files named "scaling_cur_freq" under /sys/devices/system/cpu, recursively. (I don't trust that different kernel versions won't move them around.) And we do not seem to have decent API for that: we can find directories recursively, but I don't see a good way to find files by name recursively, without writing the recursion myself. (If we did have decent API, then examples/widgets/dialogs/findfiles ought to be changed to use it, because if that were a real application, it would have this feature.) So I did the recursion myself: I call
dir.entryInfoList(nameFilters, QDir::NoDotAndDotDot | QDir::AllDirs);
then iterate the results, and if any result is another directory, recurse. But I crash during that loop, in the QFileInfo copy constructor of all places. The depth of recursion is only 3... it's not stack overflow.
1 std::__atomic_base<int>::operator++ atomic_base.h 296 0x7ffff77c270b 2 QAtomicOps<int>::ref<int> qatomic_cxx11.h 265 0x7ffff77c1b54 3 QBasicAtomicInteger<int>::ref qbasicatomic.h 113 0x7ffff77c0e5c 4 QSharedDataPointer<QFileInfoPrivate>::QSharedDataPointer qshareddata.h 92 0x7ffff7959599 5 QFileInfo::QFileInfo qfileinfo.cpp 375 0x7ffff79561fb 6 find main.cpp 10 0x4016dc 7 find main.cpp 13 0x40185c 8 find main.cpp 13 0x40185c 9 main main.cpp 23 0x401aef
The code isn't quite right, but I still was surprised to get a crash.