aboutsummaryrefslogtreecommitdiff
path: root/engines/tinsel/sched.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/tinsel/sched.cpp')
-rw-r--r--engines/tinsel/sched.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/engines/tinsel/sched.cpp b/engines/tinsel/sched.cpp
index d8a44944fc..97e41e2a7d 100644
--- a/engines/tinsel/sched.cpp
+++ b/engines/tinsel/sched.cpp
@@ -45,8 +45,6 @@ struct PROCESS_STRUC {
#include "common/pack-end.h" // END STRUCT PACKING
-CoroContext nullContext = NULL;
-
//----------------- LOCAL GLOBAL DATA --------------------
static uint32 numSceneProcess;
@@ -77,6 +75,14 @@ Scheduler::Scheduler() {
}
Scheduler::~Scheduler() {
+ // Kill all running processes (i.e. free memory allocated for their state).
+ PROCESS *pProc = active->pNext;
+ while (pProc != NULL) {
+ delete pProc->state;
+ pProc->state = 0;
+ pProc = pProc->pNext;
+ }
+
free(processList);
processList = NULL;
@@ -392,6 +398,7 @@ void Scheduler::killProcess(PROCESS *pKillProc) {
(pRCfunction)(pKillProc);
delete pKillProc->state;
+ pKillProc->state = 0;
// Take the process out of the active chain list
pKillProc->pPrevious->pNext = pKillProc->pNext;
@@ -458,6 +465,7 @@ int Scheduler::killMatchingProcess(int pidKill, int pidMask) {
(pRCfunction)(pProc);
delete pProc->state;
+ pProc->state = 0;
// make prev point to next to unlink pProc
pPrev->pNext = pProc->pNext;