PDA

View Full Version : delete my thread



Dmitry
15th October 2006, 17:29
Needed delete my thread?



...
public slots:

void startMyExecution(){
mthr = new MyThread(this);
mthr->start();
...
}

void stopMyExecution(){
mthr->stop();
delete mthr; // needed this line ?
}

jpn
15th October 2006, 17:42
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.