[Solved, Moved] More memory needed?
-
@
while (j < listaGenerale.length())
{
if(listaGenerale.at(j).contains(".mp3"))
listaFileMusicali.append("E:/Attachments/" + listaGenerale.at(j));
qDebug()<<listaFileMusicali.at(j); // think about this line, especially when
// listaGenerale.at(j).contains(".mp3") is false
j++;
}
@What makes you think that "index out of range" does indicate a insufficient memory problem, and not an out of range index?
-
nothing:
@
listaGenerale = dir.entryList();
while (j < listaGenerale.length())
{
if(listaGenerale.at(j).contains(".mp3"))
{
listaFileMusicali.append(listaGenerale.at(j));
qDebug()<<listaFileMusicali.at(j);
}
j++;
}
@@
Launched.
[Qt Message] "01 - An Deiner Seite (Radio Version) - Unheilig.mp3"
[Qt Message] "012-peter_fox_-alles_neu-ministry.mp3"
[Qt Message] "12-peter_fox-zucker(feat._vanessa_mason)-ysp.mp3"
[Qt Message] "153 andrea bocheli & laura pausini - vivo por ella.mp3"
[Qt Message] "21 guns.mp3"
[Qt Message] "21st Century Breakdown.mp3"
[Qt Message] ASSERT failure in QList<T>::at: "index out of range", file /QtSDK/Symbian/SDKs/Symbian1Qt473/include/QtCore/qlist.h, line 456
Thread has crashed: Thread 0x20c has panicked. Category: ASSERT failure i; Reason: 0
The device 'Nokia C5-03 USB Serial Port (COM9)' has been disconnected.
@and in fact next file does not contain ".mp3"
-
By all means it is not a good idea to use the same index j for different things. And that is what you are doing. If you have a list with 10 elements and you copy five of them into another list, how many elements will have you in the list?
This should work
@
listaGenerale = dir.entryList();
while (j < listaGenerale.length())
{
if(listaGenerale.at(j).contains(".mp3"))
{
listaFileMusicali.append(listaGenerale.at(j));
qDebug()<<listaGenerale.at(j);
}
j++;
}
@ -
ahahah! =D
@
listaGenerale = dir.entryList();
while (j < listaGenerale.length())
{
if(listaGenerale.at(j).contains(".mp3"))
{
listaFileMusicali.append(listaGenerale.at(j));
qDebug()<<listaGenerale.at(j);
}
j++;
}
@
i hope it is right! ;)EDIT: Damn, it is not right. it persists to throw the same error: [Qt Message] ASSERT failure in QList<T>::at: "index out of range", file /QtSDK/Symbian/SDKs/Symbian1Qt473/include/QtCore/qlist.h, line 456 (working on symbian)
-
Best way to solve these issues: make sure that you know the relevant values. Just step through the procedure with your debugger, and watch what happens. Or, perhaps just insert a bunch of qDebug() statements to print out the values of everything you touch in that piece of code. I think it would have been very easy to track this issue this way.