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. Stop download with QNetworkReply
Forum Updated to NodeBB v4.3 + New Features

Stop download with QNetworkReply

Scheduled Pinned Locked Moved Solved General and Desktop
qnetworkreply
20 Posts 4 Posters 5.4k Views 2 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.
  • mrjjM mrjj

    @ARASHz4
    Thx. its cute :)
    I can use any file for test?

    A Offline
    A Offline
    ARASHz4
    wrote on last edited by
    #11

    @mrjj yes I think

    ? mrjjM 2 Replies Last reply
    0
    • A ARASHz4

      @mrjj yes I think

      ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #12

      Hi! Does this also happen when you replace abort() with close()? Another thing: After calling abort(), is the finished() signal emitted?

      ? 1 Reply Last reply
      0
      • ? A Former User

        Hi! Does this also happen when you replace abort() with close()? Another thing: After calling abort(), is the finished() signal emitted?

        ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #13

        And: On what platform do you observe this behaviour? Windows? Linux?

        A 1 Reply Last reply
        0
        • ? Offline
          ? Offline
          A Former User
          wrote on last edited by
          #14

          BTW: In your cancelDownload() function, it says:

          reply->abort();
          reply = 0;
          

          Looks like a memory leak to me.

          1 Reply Last reply
          0
          • ? A Former User

            And: On what platform do you observe this behaviour? Windows? Linux?

            A Offline
            A Offline
            ARASHz4
            wrote on last edited by
            #15

            @Wieland
            i test before close()
            i use Windows now

            1 Reply Last reply
            0
            • A ARASHz4

              @mrjj yes I think

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #16

              @ARASHz4

              hi
              in

              Downloader::Downloader(QUrl Url, QObject *parent) :
                  QObject(parent)
              {
                  QNetworkRequest request(Url);
                  DownloadManager.get(request);<<<<< THIS ?
              
                  reply =  DownloadManager.get(request);
              

              you have extra DownloadManager.get(request);
              if I // it, it now drops to 0 when I abort.
              Before it did not.

              ? A 3 Replies Last reply
              1
              • mrjjM mrjj

                @ARASHz4

                hi
                in

                Downloader::Downloader(QUrl Url, QObject *parent) :
                    QObject(parent)
                {
                    QNetworkRequest request(Url);
                    DownloadManager.get(request);<<<<< THIS ?
                
                    reply =  DownloadManager.get(request);
                

                you have extra DownloadManager.get(request);
                if I // it, it now drops to 0 when I abort.
                Before it did not.

                ? Offline
                ? Offline
                A Former User
                wrote on last edited by
                #17

                @mrjj Guter Mann. ;-)

                1 Reply Last reply
                1
                • mrjjM mrjj

                  @ARASHz4

                  hi
                  in

                  Downloader::Downloader(QUrl Url, QObject *parent) :
                      QObject(parent)
                  {
                      QNetworkRequest request(Url);
                      DownloadManager.get(request);<<<<< THIS ?
                  
                      reply =  DownloadManager.get(request);
                  

                  you have extra DownloadManager.get(request);
                  if I // it, it now drops to 0 when I abort.
                  Before it did not.

                  A Offline
                  A Offline
                  ARASHz4
                  wrote on last edited by ARASHz4
                  #18

                  @mrjj DownloadManager is a private member in downloader.h

                  1 Reply Last reply
                  0
                  • mrjjM mrjj

                    @ARASHz4

                    hi
                    in

                    Downloader::Downloader(QUrl Url, QObject *parent) :
                        QObject(parent)
                    {
                        QNetworkRequest request(Url);
                        DownloadManager.get(request);<<<<< THIS ?
                    
                        reply =  DownloadManager.get(request);
                    

                    you have extra DownloadManager.get(request);
                    if I // it, it now drops to 0 when I abort.
                    Before it did not.

                    A Offline
                    A Offline
                    ARASHz4
                    wrote on last edited by
                    #19

                    @mrjj Yes thank you now I understand
                    i Fix it

                    1 Reply Last reply
                    0
                    • S Offline
                      S Offline
                      seyed
                      wrote on last edited by
                      #20

                      In my case, disconnecting all signals relating to QNetworkReply from all slots causes to abort() not works.

                      disconnect(m_reply, nullptr, nullptr, nullptr);
                      

                      abort function works normal after commenting this line.

                      1 Reply Last reply
                      2

                      • Login

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