changeset 12120:5ccf040e4f3e draft

(svn r16534) -Fix [Squirrel] [FS#2942]: fix crash that occured when an AI was halted while one or more generators were still in a 'running' state
author yexo <yexo@openttd.org>
date Sun, 07 Jun 2009 20:20:22 +0000
parents 4a13876f1ada
children da26b364cc6a
files src/3rdparty/squirrel/squirrel/sqstate.cpp
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/3rdparty/squirrel/squirrel/sqstate.cpp
+++ b/src/3rdparty/squirrel/squirrel/sqstate.cpp
@@ -189,8 +189,12 @@
 	SQCollectable *t = _gc_chain;
 	SQCollectable *nx = NULL;
 	while(t) {
+		t->_uiRef++;
+		t = t->_next;
+	}
+	t = _gc_chain;
+	while(t) {
 		t->UnMark();
-		t->_uiRef++;
 		t->Finalize();
 		nx = t->_next;
 		if(--t->_uiRef == 0)