[Scummvm-cvs-logs] CVS: residual/lua ltask.cpp,1.7,1.8

Erich Edgar Hoover compholio at users.sourceforge.net
Thu Jul 21 09:02:55 CEST 2005


Update of /cvsroot/scummvm/residual/lua
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10421/lua

Modified Files:
	ltask.cpp 
Log Message:
Fix for scene changing bug (task cleanup problem) - better SMUSH looping - actor choring now allowed when actor not visible.  commit from wrong folder, here's the rest.

Index: ltask.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/lua/ltask.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- ltask.cpp	8 Apr 2005 22:29:06 -0000	1.7
+++ ltask.cpp	21 Jul 2005 15:16:35 -0000	1.8
@@ -241,9 +241,10 @@
 
 	prev = L->root_task;
 	while ((t = prev->next) != NULL) {
+		luaI_switchtask(t);
+		// Tstate is not available until after switching tasks
 		if (t->Tstate == PAUSE)
 			continue;
-		luaI_switchtask(t);
 		L->errorJmp = &myErrorJmp;
 		L->Tstate = RUN;
 		if (setjmp(myErrorJmp) == 0) {
@@ -255,7 +256,17 @@
 			L->Tstate = DONE;
 		}
 		L->errorJmp = NULL;
-		if (L->Tstate == DONE) { /* Remove from list of active tasks */
+		prev = t;
+	}
+	// Free the completed tasks
+	// This MUST occur after all the tasks have been run (not during)
+	// or else when one task is freed right after another the task
+	// execution gets hosed.  Test Case: Switching between tw.set and
+	// tb.set in Rubacava causes a crash without this.
+	prev = L->root_task;
+	while ((t = prev->next) != NULL) {
+		luaI_switchtask(t);
+		if (L->Tstate == DONE) { // Remove from list of active tasks
 			luaI_switchtask(old_task);
 			prev->next = t->next;
 			t->next = NULL;





More information about the Scummvm-git-logs mailing list