← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-pkg/yade/git-trunk] Rev 4152: Create an array of clump`s memberIds to remove.

 

------------------------------------------------------------
revno: 4152
committer: Anton Gladky <gladky.anton@xxxxxxxxx>
timestamp: Mon 2014-09-01 11:53:04 +0200
message:
  Create an array of clump`s memberIds to remove.
  
  During the clump removal with all its members
  there is a situtation on 32-bit platforms, that
  the memberId is not defined correctly after one
  of clump member is already removed.
  
  Create a "static" array of all ids and iterate
  over them.
modified:
  core/BodyContainer.cpp


--
lp:yade
https://code.launchpad.net/~yade-pkg/yade/git-trunk

Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to https://code.launchpad.net/~yade-pkg/yade/git-trunk/+edit-subscription
=== modified file 'core/BodyContainer.cpp'
--- core/BodyContainer.cpp	2014-08-18 22:44:44 +0000
+++ core/BodyContainer.cpp	2014-09-01 09:53:04 +0000
@@ -41,8 +41,9 @@
 		//erase all members if eraseClumpMembers is true:
 		const shared_ptr<Clump>& clump=YADE_PTR_CAST<Clump>(b->shape);
 		std::map<Body::id_t,Se3r>& members = clump->members;
-		FOREACH(MemberMap::value_type& mm, members){
-			const Body::id_t& memberId=mm.first;
+		std::vector<Body::id_t> idsToRemove;
+		FOREACH(MemberMap::value_type mm, members) idsToRemove.push_back(mm.first); // Prepare an array of ids, which need to be removed.
+		FOREACH(Body::id_t memberId, idsToRemove){
 			if (eraseClumpMembers) {
 				this->erase(memberId,false);	// erase members
 			} else {