Results 1 to 2 of 2

Thread: delete my thread

  1. #1
    Join Date
    Jan 2006
    Posts
    9
    Thanks
    1
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default delete my thread

    Needed delete my thread?

    Qt Code:
    1. ...
    2. public slots:
    3.  
    4. void startMyExecution(){
    5. mthr = new MyThread(this);
    6. mthr->start();
    7. ...
    8. }
    9.  
    10. void stopMyExecution(){
    11. mthr->stop();
    12. delete mthr; // needed this line ?
    13. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: delete my thread

    It's not a must to delete the thread object, it will eventually get deleted by it's parent. However, if you are creating lots of those thread objects, you'll end up having them all in memory for the rest of the application's life time.
    J-P Nurmi

Similar Threads

  1. Problem closing a QMainWindow in Qt4.2
    By ian in forum Qt Programming
    Replies: 11
    Last Post: 17th October 2006, 00:49
  2. simple thread layout question
    By mhoover in forum Qt Programming
    Replies: 1
    Last Post: 12th August 2006, 11:02
  3. Replies: 11
    Last Post: 7th July 2006, 13:09
  4. [QT4] QThread and printing a QList<QPixmap>
    By KShots in forum Qt Programming
    Replies: 3
    Last Post: 24th April 2006, 21:44
  5. Replies: 2
    Last Post: 6th January 2006, 21:15

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.