Results 1 to 8 of 8

Thread: program crashes on unreadable characters. SOLVED

  1. #1
    Join Date
    Dec 2007
    Location
    Groningen Netherlands
    Posts
    182
    Thanks
    16
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default program crashes on unreadable characters. SOLVED

    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>:perator[]: "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.
    Last edited by JeanC; 1st March 2008 at 19:54.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: program crashes on unreadable characters.

    Could you post a minimal compilable example reproducing the problem?

  3. #3
    Join Date
    Dec 2007
    Location
    Groningen Netherlands
    Posts
    182
    Thanks
    16
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: program crashes on unreadable characters.

    Quote Originally Posted by wysota View Post
    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()

    Qt Code:
    1. QString mapname = QString("/home/jean/serverd/Clannad/";
    2. QDir songmap = QDir(mapname, "*.mp3", QDir::Name, QDir::Files);
    3. QStringList songnames = songmap.entryList();
    4. for (int i = 0; i < songnames.count(); i++)
    5. qDebug() << songnames.at(i);
    To copy to clipboard, switch view to plain text mode 

    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.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: program crashes on unreadable characters.

    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?

  5. #5
    Join Date
    Dec 2007
    Location
    Groningen Netherlands
    Posts
    182
    Thanks
    16
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: program crashes on unreadable characters.

    Quote Originally Posted by wysota View Post
    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.

  6. #6
    Join Date
    Dec 2007
    Location
    Groningen Netherlands
    Posts
    182
    Thanks
    16
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: program crashes on unreadable characters.

    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!

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: program crashes on unreadable characters.

    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.

  8. #8
    Join Date
    Dec 2007
    Location
    Groningen Netherlands
    Posts
    182
    Thanks
    16
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: program crashes on unreadable characters.

    Quote Originally Posted by wysota View Post
    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.

Similar Threads

  1. Program crashes with assert error in xcb_lock.c
    By Valheru in forum Qt Programming
    Replies: 3
    Last Post: 18th November 2007, 19:56
  2. Problem at time compilation in traslation of language
    By thomasjoy in forum Qt Programming
    Replies: 3
    Last Post: 22nd May 2007, 14:18
  3. QT MySQL
    By sabeeshcs in forum Newbie
    Replies: 6
    Last Post: 12th January 2007, 04:19
  4. Reading from TCP Socket crashes program
    By OnionRingOfDoom in forum Qt Programming
    Replies: 26
    Last Post: 27th January 2006, 19:32

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.