[Scummvm-cvs-logs] SF.net SVN: scummvm:[53933] scummvm/trunk/engines/tinsel/sched.cpp
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Sat Oct 30 02:33:32 CEST 2010
Revision: 53933
http://scummvm.svn.sourceforge.net/scummvm/?rev=53933&view=rev
Author: fingolfin
Date: 2010-10-30 00:33:31 +0000 (Sat, 30 Oct 2010)
Log Message:
-----------
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.
Modified Paths:
--------------
scummvm/trunk/engines/tinsel/sched.cpp
Modified: scummvm/trunk/engines/tinsel/sched.cpp
===================================================================
--- scummvm/trunk/engines/tinsel/sched.cpp 2010-10-30 00:33:11 UTC (rev 53932)
+++ scummvm/trunk/engines/tinsel/sched.cpp 2010-10-30 00:33:31 UTC (rev 53933)
@@ -77,6 +77,14 @@
}
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 @@
(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 @@
(pRCfunction)(pProc);
delete pProc->state;
+ pProc->state = 0;
// make prev point to next to unlink pProc
pPrev->pNext = pProc->pNext;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list