Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [solved] Qt application crashes when accessing QList<QLlnkedList<QUrl>* > from NetworkAccessManager->get() callback

[solved] Qt application crashes when accessing QList<QLlnkedList<QUrl>* > from NetworkAccessManager->get() callback

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 803 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • _ Offline
    _ Offline
    _nik
    wrote on last edited by
    #1

    I am currently trying to map redirect urls back to their original urls when using QNetworkAccessManager since I haven't found a built in function.

    My application crashes when I am trying to access a QList<QLinkedList<QUrl>* > within the replyFinished(QNetworkReply* networkReply); slot of a QNetworkAccessManager.

    If the url is a redirect url, I basically loop once over the list add the redirect url to the list, load the redirected url and then exit the function:

    @foreach (QLinkedList<QUrl>* list, mList) {
    if (list->front() == url) {
    list->prepend(someUrl);
    mNetworkAccessManager->get(someUrl);
    return;
    }
    }@

    If the url I got is not a redirect url, I execute the following code:

    @QList<QLinkedList<QUrl>* >::iterator it = mList.begin();
    while (it != mList.end()) {
    QLinkedList<QUrl>* list = *it;

    if (list->front() == networkReply->url()) {
        QUrl originalUrl = list->back();
        this->someOperation(originalUrl);
        mList.erase(it);
        delete list;
        break;
    }
    

    }@

    The code above basically looks up the original url in the QLinkedList. The reason I use a QList around the QLinkedList is that I can have multiple requests running at the same time.

    Somehow my application freezes and I can't do anything. Is it because replyFinished() gets called in a different Thread and it's trying to access things in the Main Thread or what's the reason behind it?

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved