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. Warning when cancel download file?
Forum Updated to NodeBB v4.3 + New Features

Warning when cancel download file?

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 3 Posters 845 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.
  • K Offline
    K Offline
    Kien Bui
    wrote on last edited by
    #1

    [CODE]QCoreApplication::postEvent: Unexpected null receiver
    [/CODE]

    I don't know call what.
    I make a downloader into a app, when I cancel download, I waning on console.
    I don't know how to debug with problem.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Are you doing any delete call in your code ?

      By the way, which version of Qt are you using ?
      On what platform ?

      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
      1
      • K Offline
        K Offline
        Kien Bui
        wrote on last edited by Kien Bui
        #3

        Sure. I used delete

        I code and run at Linux (ubuntu14.04)
        Qt5.2.
        Addition, Am I wrong?

        QNetworkReply *reply;
        ...
        if (reply != nullptr)
            {
                reply->disconnect();
                reply->abort();
                reply->deleteLater();
                reply = nullptr;
            }
        
        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          From the snippet you posted, you don't use delete but deleteLater. Why are you calling disconnect ? It will kill all connections done to the object.

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

          K 1 Reply Last reply
          1
          • SGaistS SGaist

            From the snippet you posted, you don't use delete but deleteLater. Why are you calling disconnect ? It will kill all connections done to the object.

            K Offline
            K Offline
            Kien Bui
            wrote on last edited by
            #5

            @SGaist but when I use deleteLater() download progress still is working, I need stop download file immedicately

            S 1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Because the event loop has not yet processed every event thus the download might go some bytes further defore everything is processed.

              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
              1
              • K Kien Bui

                @SGaist but when I use deleteLater() download progress still is working, I need stop download file immedicately

                S Offline
                S Offline
                seyed
                wrote on last edited by
                #7

                @Kien-Bui for me, I called deleteLater 2 times while I set the m_reply as null after the first time, so the second time Qt warned me QCoreApplication::postEvent: Unexpected null receiver correctly.
                That behavior was because I forgot that calling abort results in emitting the finished signal.
                Just for testing, wrap the deleteLater with a null checking if statement.

                if (this->reply != nullptr) {
                        this->reply->deleteLater();
                

                Also, you can use the delete with care if you like.

                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