From: <kla...@us...> - 2016-07-03 07:24:58
|
Revision: 13714 http://sourceforge.net/p/vegastrike/code/13714 Author: klaussfreire Date: 2016-07-03 07:24:55 +0000 (Sun, 03 Jul 2016) Log Message: ----------- Fix segfault when building an iterator for a collection of killed units The iterator was being registered too late (after calling erase) so erase was performing unsafe list manipulations. May fix #680 and related errors. Telltale signs of this bug are crashes shortly after a bunch of subunits get killed (UNIT HAS DIED in the last few lines of log output), which happen more often than not when killing units with missiles. Modified Paths: -------------- trunk/vegastrike/src/cmd/collection.cpp Modified: trunk/vegastrike/src/cmd/collection.cpp =================================================================== --- trunk/vegastrike/src/cmd/collection.cpp 2016-07-03 07:08:54 UTC (rev 13713) +++ trunk/vegastrike/src/cmd/collection.cpp 2016-07-03 07:24:55 UTC (rev 13714) @@ -43,6 +43,7 @@ { col = orig; it = col->u.begin(); + col->reg(this); while(it != col->u.end()){ if((*it) == NULL) ++it; @@ -53,7 +54,6 @@ break; } } - col->reg(this); } UnitCollection::UnitIterator::~UnitIterator() |