PDA

View Full Version : program crashes on unreadable characters. SOLVED



JeanC
1st March 2008, 16:40
Hello,

I have problems with filenames on my thingy.

A filename like 'Clannad Crann Ull 03 Cruscin Lán.mp3' does not even show up in a listing from QDir::entryList().

A filename like 'Clannad Crann Ull 06 Crann Úll.mp3' makes the program crash, but I can't even figure out exactly where and why. I store it in a QstringList and my guess is that something gets corrupted because of the filename.

ASSERT failure in QList<T>::operator[]: "index out of range", file /usr/local/Trolltech/Qt-4.3.4/include/QtCore/qlist.h, line 399

I think this is not only an issue with Qt, but also with my ubuntu 7.10 here which doesn't even displays those names correctly.
What can I do?

Thanks, Jean.

wysota
1st March 2008, 17:09
Could you post a minimal compilable example reproducing the problem?

JeanC
1st March 2008, 17:20
Could you post a minimal compilable example reproducing the problem?

Hi there wysota,

This is the first case, where a file does not make it into entryList()



QString mapname = QString("/home/jean/serverd/Clannad/";
QDir songmap = QDir(mapname, "*.mp3", QDir::Name, QDir::Files);
QStringList songnames = songmap.entryList();
for (int i = 0; i < songnames.count(); i++)
qDebug() << songnames.at(i);


I tried to pinpoint the second example with the crash but it kept puzzling me exactly what code caused the crash. If I kept out something unrelated the crash stopped, so my guess is that something gets corrupted and somehow cumulates. I will try again and find something reproducable that crashes.

wysota
1st March 2008, 17:28
I think the crash is casued by an incorrect traversal of a list caused by the missing element. As for the missing one itself, it could be a bug either in Qt or an underlying mechanism (filesystem?). What is your filesystem encoding and what is the filesystem you are using?

JeanC
1st March 2008, 17:54
I think the crash is casued by an incorrect traversal of a list caused by the missing element. As for the missing one itself, it could be a bug either in Qt or an underlying mechanism (filesystem?). What is your filesystem encoding and what is the filesystem you are using?

You may be on to something there, this is on a shared windows drive, so ntfs, mounted with cifs:
//192.168.1.10/D /home/jean/serverd cifs auto,rw,username=guest,password=,file_mode=0777,di r_mode=0777,user 0 0

(how do I find out about the filesystem encoding?)

Sigh I cannot even copy files to my homedir to test it on ext3, it can't read those.

JeanC
1st March 2008, 19:01
I am trying to find the right way to mount that drive, from fstab:

//192.168.1.10/D /home/jean/serverd cifs auto,rw,username=guest,password=,file_mode=0777,di r_mode=0777,user,iocharset=8859-1,codepage=850 0 0

I stil get the ??? in the filenames.
Somebody?
Thanks!

wysota
1st March 2008, 19:49
Try "nls=utf-8" option. Or "iocharset=utf-8" (if your system is utf-8 based). Anyway your problem seems to be not Qt related.

JeanC
1st March 2008, 20:53
Try "nls=utf-8" option. Or "iocharset=utf-8" (if your system is utf-8 based).

Nope.


Anyway your problem seems to be not Qt related.

Yes indeed. And I know now what's wrong.

Thanks wysota.