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. Non-virtual destructor in QNetworkAccessManager

Non-virtual destructor in QNetworkAccessManager

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 2.7k 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.
  • R Offline
    R Offline
    ravehanker
    wrote on last edited by
    #1

    I'm subclassing QNetworkAccessManager to provide for a custom protocol as per http://doc.trolltech.com/qq/32/qq32-webkit-protocols.html and I see that the destructor for QNetworkAccessManager is non-virutal(http://doc.qt.nokia.com/4.7-snapshot/qnetworkaccessmanager.html#dtor.QNetworkAccessManager).
    I can see that this will not work if do not set a parent for the object and hold a reference to it as a QNetworkAccessManager.
    Will the object be destroyed properly if I set a parent to it? Does QObject's destructor handle children with non-virtual destructors properly?

    1 Reply Last reply
    0
    • G Offline
      G Offline
      goetz
      wrote on last edited by
      #2

      QNetworkAccessManager inherits from QObject. The latter has marked it's destructor as virtual, so subsequently the destructors of all derived classes are virtual too.

      See "FAQ 20.7":http://www.parashift.com/c++-faq-lite/virtual-functions.html#faq-20.7 of the C++ FAQ for an explanation.

      The object will be destroyed properly when it has a parent.

      http://www.catb.org/~esr/faqs/smart-questions.html

      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