On Tue, 28 Aug 2012 02:32:35 PM Michael Vehrs wrote: > I have attached a patch to let Unit inherit from GoodsLocation. However, > it runs out of heap space when calling disposeList() in > server.ai.mission.TransportMissionTest. And I am too stupid to see where > it loops or runs into an infinite recursion.
I found two things that were wrong. - Unit.disposeList should not explicitly dispose of its goods container any more now that it extends GoodsLocation, that is GoodsLocation.disposeList's job. To make that happen though, Unit.disposeList does have to call objects.addAll(super.disposeList()) just before returning. Similarly, because it is also a UnitLocation, it should not dispose of its units either. And again, it should not dispose of itself! Or at least that is how Settlement (our other GoodsLocation derivative) works. - csDamageShip was assuming that disposing of a Unit cargo would remove it from the unit list. Disposing passes through Unit.remove() which calls getUnitList().remove(locatable), which does not do what we want because getUnitList() always returns a copy of the current list. The main fix is to simplify Unit.remove() to just call its superclass for Goods and Units. csDamageShip is also being too presumptive, so I also changed that to unload its cargo before attempting to dispose. Since that bit is mostly unrelated to the patch, it has been committed. With those two fixes made, a clean non-crashing test build occurs. There are a couple of interesting loose ends I am still looking at, but I am out of time for now. An amended patch will follow in due course. Cheers, Mike Pope
signature.asc
Description: This is a digitally signed message part.
------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________ Freecol-developers mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/freecol-developers
