mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-11 13:45:25 +00:00
TINSEL: Dispose state of active coroutines in Scheduler destructor
This fixes some leaks that occurred when exiting the game resp. returning to launcher. Note that we still leak some coroutines when exiting after loading a savegame. svn-id: r53933
This commit is contained in:
parent
55a8bd9e35
commit
afb5986c9e
@ -77,6 +77,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 +400,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 +467,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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user