PDA

View Full Version : [QDir] impossible to list files.



LaurentDuroisin
18th January 2016, 16:22
Hi, I want to browse directories to find files, so, I've tried something like this :



QDir dir(path);
QFileInfoList list = dir.entryInfoList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot);
foreach(QFileInfo finfo, list) {
if (finfo.isDir()) {
findFileFromCurrentDirectory(finfo.absoluteFilePat h());
}
}


But the program has just been terminated sundenly.

Thanks. (I'm on linux)

Lesiok
18th January 2016, 16:35
I'm guessing that this code is from function findFileFromCurrentDirectory. If so, you have a recurrence which can cause a stack overflow.

LaurentDuroisin
18th January 2016, 16:46
I'm guessing that this code is from function findFileFromCurrentDirectory. If so, you have a recurrence which can cause a stack overflow.


Stack overflow which only one recurrence call. :confused:

It only output the first dir name, and then it crash.

Lesiok
18th January 2016, 19:43
So use this cool tool called "debugger".

LaurentDuroisin
19th January 2016, 10:09
I've solved the issue, thanks.

d_stranz
19th January 2016, 16:44
I've solved the issue, thanks.

Well, keep it a secret so others can struggle with it too.

This forum isn't a one-way street, you know.