Results 1 to 13 of 13

Thread: Destructor not being called

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Thanked 370 Times in 336 Posts

    Default Re: Destructor not being called

    is dtor of MainWindow called? looks like no.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  2. #2
    Join Date
    Apr 2007
    Location
    Sunny Darwin, NT Australia
    Posts
    186
    Qt products
    Qt4
    Platforms
    Unix/X11
    Thanks
    29
    Thanked 5 Times in 5 Posts

    Default Re: Destructor not being called

    Quote Originally Posted by spirit View Post
    is dtor of MainWindow called? looks like no.
    Why would MainWindow's dtor have anything to do with it ?
    ... I see it now .....
    in the ctor, it needed:
    Qt Code:
    1. setAttribute(Qt::WA_DeleteOnClose);
    To copy to clipboard, switch view to plain text mode 

    Thanks for the kick !

  3. #3
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Thanked 370 Times in 336 Posts

    Default Re: Destructor not being called

    Quote Originally Posted by vieraci View Post
    Why would MainWindow's dtor have anything to do with it ?
    ... I see it now .....
    in the ctor, it needed:
    Qt Code:
    1. setAttribute(Qt::WA_DeleteOnClose);
    To copy to clipboard, switch view to plain text mode 

    Thanks for the kick !
    because, if you remeber, when you pass a parent into ctor of objects which subclassed from QObject Qt will delete all children by itself when a parent's dtor is being called. but if you don't pass a parent in ctor of objects then you have to delete these objectcs by yourself.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  4. The following user says thank you to spirit for this useful post:

    vieraci (15th May 2009)

Similar Threads

  1. setSceneRect not being called properly?
    By bjh in forum Qt Programming
    Replies: 7
    Last Post: 12th July 2009, 19:42
  2. Replies: 4
    Last Post: 19th April 2009, 15:51
  3. filterAcceptsRow is not called.
    By kaushal_gaurav in forum Qt Programming
    Replies: 1
    Last Post: 10th February 2009, 08:05
  4. Replies: 1
    Last Post: 7th August 2008, 13:46
  5. QWidget::resizeEvent is not called
    By maximAL in forum Qt Programming
    Replies: 9
    Last Post: 3rd February 2008, 16:41

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.