Page 1 of 1

Problem with derived ~wxThread()

Posted: Wed Feb 17, 2016 2:42 pm
by Tapsa
I followed the wxThread example in here:
http://docs.wxwidgets.org/trunk/classwx_thread.html
I made my own class that inherits wxThread, but its destructor is never executed.

Code: Select all

~MyThread();

Code: Select all

MyThread::~MyThread()
{
    ... // Set the thread pointer of my frame to 0 so I can check if this thread is executing or not.
}
I can see the exit code appear in command prompt and my queued event ( = what to do after completion) executes as it should.
I'm worried that the wxThread objects pile up over time and never die.
My thread calls this in its constructor:

Code: Select all

wxThread(wxTHREAD_JOINABLE)
What have I missed and how do I ensure that threads get destructed?

EDIT: Had to create the threads as detached.