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. Weird crash of QNetworkAccessManager::post()
Forum Updated to NodeBB v4.3 + New Features

Weird crash of QNetworkAccessManager::post()

Scheduled Pinned Locked Moved Solved General and Desktop
22 Posts 7 Posters 8.1k 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.
  • kshegunovK kshegunov

    @MemphisWang said in Weird crash of QNetworkAccessManager::post():

    can i continue to use this pointer immediately

    Yes, you can even use the same object immediately.

    this->pObj = new Foo();
    this->pObj->doingSomeThing();
    this->pObj->deleteLater();
    
    this->pObj->someOtherThing(); //< Valid until you return control to the event loop
    
    M Offline
    M Offline
    MemphisWang
    wrote on last edited by
    #21

    @kshegunov that's nice, and convenient. I can be less careful about memory and care more about business logic.

    kshegunovK 1 Reply Last reply
    0
    • M MemphisWang

      @kshegunov that's nice, and convenient. I can be less careful about memory and care more about business logic.

      kshegunovK Offline
      kshegunovK Offline
      kshegunov
      Moderators
      wrote on last edited by
      #22

      Well, it's "invented" not to make you less careful about memory, but exactly because deleteing an object that's referenced in a queued event in the event loop is pretty nasty - I'd segfault.

      Read and abide by the Qt Code of Conduct

      1 Reply Last reply
      1

      • Login

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