(svn r13417) -Fix (r12945, r13413): freeing the ThreadObjects in a manner that hopefully doesn't cause crashes.
This commit is contained in:
@@ -57,7 +57,6 @@ void KPutStr(CONST_STRPTR format)
|
||||
class ThreadObject_MorphOS : public ThreadObject {
|
||||
private:
|
||||
APTR m_thr; ///< System thread identifier.
|
||||
OTTDThreadTerminateFunc m_terminate_func; ///< Function to call on thread termination.
|
||||
struct MsgPort *m_replyport;
|
||||
struct OTTDThreadStartupMessage m_msg;
|
||||
|
||||
@@ -65,9 +64,7 @@ public:
|
||||
/**
|
||||
* Create a sub process and start it, calling proc(param).
|
||||
*/
|
||||
ThreadObject_MorphOS(OTTDThreadFunc proc, void *param, OTTDThreadTerminateFunc terminate_func) :
|
||||
m_thr(0),
|
||||
m_terminate_func(terminate_func)
|
||||
ThreadObject_MorphOS(OTTDThreadFunc proc, void *param) : m_thr(0)
|
||||
{
|
||||
struct Task *parent;
|
||||
|
||||
@@ -114,9 +111,7 @@ public:
|
||||
/**
|
||||
* Create a thread and attach current thread to it.
|
||||
*/
|
||||
ThreadObject_MorphOS() :
|
||||
m_thr(0),
|
||||
m_terminate_func(NULL)
|
||||
ThreadObject_MorphOS() : m_thr(0)
|
||||
{
|
||||
m_thr = FindTask(NULL);
|
||||
}
|
||||
@@ -215,14 +210,12 @@ private:
|
||||
|
||||
/* Quit the child, exec.library will reply the startup msg internally. */
|
||||
KPutStr("[Child] Done.\n");
|
||||
|
||||
if (this->terminate_func != NULL) this->terminate_func(this);
|
||||
}
|
||||
};
|
||||
|
||||
/* static */ ThreadObject *ThreadObject::New(OTTDThreadFunc proc, void *param, OTTDThreadTerminateFunc terminate_func)
|
||||
/* static */ ThreadObject *ThreadObject::New(OTTDThreadFunc proc, void *param)
|
||||
{
|
||||
return new ThreadObject_MorphOS(proc, param, terminate_func);
|
||||
return new ThreadObject_MorphOS(proc, param);
|
||||
}
|
||||
|
||||
/* static */ ThreadObject *ThreadObject::AttachCurrent()
|
||||
|
Reference in New Issue
Block a user