diff --git a/src/thread_morphos.cpp b/src/thread_morphos.cpp index 6cd9e14..348e46d 100644 --- a/src/thread_morphos.cpp +++ b/src/thread_morphos.cpp @@ -179,6 +179,8 @@ public: DeleteMsgPort(m_replyport); m_thr = 0; + delete this; + return ret; } diff --git a/src/thread_win32.cpp b/src/thread_win32.cpp index d6f44a8..5395a5f 100644 --- a/src/thread_win32.cpp +++ b/src/thread_win32.cpp @@ -98,7 +98,10 @@ public: WaitForSingleObject(m_h_thr, INFINITE); - return this->ret; + void *ret = this->ret; + delete this; + + return ret; } /* virtual */ bool IsCurrent()