Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Solved When qnetworkreply is delete after request from QNetworkAccessManager::get(QNetworkRequest request (url))?

    General and Desktop
    qnetworkreply qnetworkaccessm qnetworkrequest qnetwork
    2
    2
    163
    Loading More Posts
    • 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.
    • Y
      Yash001 last edited by Yash001

      I am accessing the network using QNetworkRequest , QNetworkAccessManager, and QNetworkReply.

      At which place m_reply delete? it will delete when manager delete or it will delete at any other place?

      QNetworkAccessManager* manager = new QNetworkAccessManager();
      auto  m_reply = manager ->get(QNetworkRequest request (https://www.google.com));
      
      // Here  read all the data from m_reply and call m_reply->close();
      
      // again use same manage for request data 
      m_reply = manager ->get(QNetworkRequest request (https://www.facebook.com));
      
      

      Can I use m_reply variable in this way?

      1 Reply Last reply Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        Hi,

        Usually you don't store the reply but rather connect its signals to lambdas, do the processing there and then call deleteLater on it once you are done.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply Reply Quote 2
        • SGaist
          SGaist Lifetime Qt Champion last edited by

          Hi,

          Usually you don't store the reply but rather connect its signals to lambdas, do the processing there and then call deleteLater on it once you are done.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply Reply Quote 2
          • First post
            Last post