← Back to team overview

yade-dev team mailing list archive

Re: [Bug 803774] Re: Saving, loading simulation with erased bodies crash.

 

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();
}


On 15 Jul 2012, at 18:08, Chareyre wrote:

> Running one additional step without erasing may avoid the problem, but it
> still needs a fix.
> 
> -- 
> You received this bug notification because you are a member of Yade
> developers, which is the registrant for Yade.
> https://bugs.launchpad.net/bugs/803774
> 
> Title:
>  Saving, loading simulation with erased bodies crash.
> 
> Status in Yet Another Dynamic Engine:
>  Fix Released
> 
> Bug description:
>  Here is the bug :
> 
>  - launch yade (for example without any script)
>  - add a sphere : O.bodies.append(utils.sphere((0.2,0.2,0.2),0.006))
>  - delete it : O.bodies.erase(0)
>  - save yade's universe : O.save("./test")
>  - quit yade
>  - launch yade
>  - load the file : O.load("./test")
>  ->segmentation fault
> 
>  I think it's because when you erase something the size of O.bodies (etc...) doesn't change and now contains an empty value. (the c++ array may not be dynamic ?)
>  So when the O.load() function is called, yade try to load a non-existant body ?
> 
>  Maybe this can be fixed by changing the load() method ?
> 
>  I joined the debug output.
> 
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/yade/+bug/803774/+subscriptions
> 
> _______________________________________________
> Mailing list: https://launchpad.net/~yade-dev
> Post to     : yade-dev@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~yade-dev
> More help   : https://help.launchpad.net/ListHelp

-- 
You received this bug notification because you are a member of Yade
developers, which is the registrant for Yade.
https://bugs.launchpad.net/bugs/803774

Title:
  Saving, loading simulation with erased bodies crash.

Status in Yet Another Dynamic Engine:
  Fix Released

Bug description:
  Here is the bug :

  - launch yade (for example without any script)
  - add a sphere : O.bodies.append(utils.sphere((0.2,0.2,0.2),0.006))
  - delete it : O.bodies.erase(0)
  - save yade's universe : O.save("./test")
  - quit yade
  - launch yade
  - load the file : O.load("./test")
  ->segmentation fault

  I think it's because when you erase something the size of O.bodies (etc...) doesn't change and now contains an empty value. (the c++ array may not be dynamic ?)
  So when the O.load() function is called, yade try to load a non-existant body ?

  Maybe this can be fixed by changing the load() method ?

  I joined the debug output.

To manage notifications about this bug go to:
https://bugs.launchpad.net/yade/+bug/803774/+subscriptions


Follow ups

References