yade-dev team mailing list archive
-
yade-dev team
-
Mailing list archive
-
Message #07454
Re: [Bug 759481] Re: Possible "wrong memory access" in many places
13.04.2011 10:36, Anton Gladky:
Is it ok for everybody to fix the code by this way?
There is almost everywhere "if(!I->isReal()) continue;", but it insufficient, probably...
This is not a case.
If you look at BodyContainer::erase and InteractionContainer::erase you
will see differencies.
For BodyContainer::erase we have:
122 body[id]=shared_ptr<Body>();
So a case "if !B" is adequate for it.
But for InteractionContainer::erase we have:
54 if (linIx<(int)currSize-1) {
55 linIntrs[linIx]=linIntrs[currSize-1];
56 linIntrs[linIx]->linIx=linIx; // update the back-reference inside the
interaction
57 }
58 //assert(linIntrs.size()==currSize);
59 // in either case, last element can be removed now
60 linIntrs.resize(--currSize); // currSize updated
So "if !I" is have no sense from this point.
The bug is in another place (if any).
--
Best regards,
Sergei Dorofeenko,
Cand. Phys.-Mat. Sci.
Institute of Problems of Chemical Physics,
Chernogolovka, Moscow region, Russia.
e-mail: dorofeenko@xxxxxxxxx
References