Comment 15 for bug 803774

Revision history for this message
Anton Gladky (gladky-anton) wrote : Re: [Yade-dev] [Bug 803774] Re: Saving, loading simulation with erased bodies crash.

Well, if it fixes your problem, at least prevents a crash, I am ok to
commit it. I don't see any regressions here.

Please, let me know.

Anton

2012/7/15 Chiara Modenese <email address hidden>:
> I found one solution but I think is a temporary fix. The problem is that
> somehow interactions are not deleted properly. Below is a modified
> version of postLoad__calledFromScene - I am checking whether both bodies
> in contact actually exist before the interaction is inserted, otherwise
> return - but is not the core solution to the bug so I will post it here
> although not commit.
>
> Chiara
>
> void InteractionContainer::postLoad__calledFromScene(const shared_ptr<BodyContainer>& bb){
> bodies=&bb->body; // update the internal pointer
> clear();
> FOREACH(const shared_ptr<Interaction>& I, interaction){
> Body::id_t id1=I->getId1(), id2=I->getId2();
> if (!(*bodies)[id1] || !(*bodies)[id2]) return;
> else insert(I);}
> interaction.clear();
> }
>