My application freezes when I am trying to access a QList<QLinkedList<QUrl>* >
within the replyFinished(QNetworkReply* networkReply);
slot of a QNetworkAccessManager
.
I basically loop once over the list add something to the list and then exit the function:
foreach (QLinkedList<QUrl>* list, mList) {
if (list->front() == url) {
list->prepend(someUrl);
mNetworkAccessManager->get(someUrl);
return;
}
}
In the other scenario I do the following:
QList<QLinkedList<QUrl>* >::iterator it = mList.begin();
while (it != mList.end()) {
QLinkedList<QUrl>* list = *it;
if (list->front() == networkReply->url()) {
// some operation with list->back();
mList.erase(it);
delete list;
break;
}
}
Is there any way to make this construct safe?
I was caught in an endless loop, since
never increased the iterator ..