diff options
author | rubidium <rubidium@openttd.org> | 2008-06-08 15:27:57 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2008-06-08 15:27:57 +0000 |
commit | e43d0507301689d6178d310c98b1403588eb474f (patch) | |
tree | 376004aeb09d74a071fcdddcc61f01e9ea005d8b /src/thread_morphos.cpp | |
parent | eac3301b63070ad0c0f1ce1323f25326ce90226d (diff) | |
download | openttd-e43d0507301689d6178d310c98b1403588eb474f.tar.xz |
(svn r13417) -Fix (r12945, r13413): freeing the ThreadObjects in a manner that hopefully doesn't cause crashes.
Diffstat (limited to 'src/thread_morphos.cpp')
-rw-r--r-- | src/thread_morphos.cpp | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/src/thread_morphos.cpp b/src/thread_morphos.cpp index 6df33baac..ef074da45 100644 --- a/src/thread_morphos.cpp +++ b/src/thread_morphos.cpp @@ -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() |