← Back to team overview

yade-users team mailing list archive

Re: [Question #696648]: Image and erase

 

Question #696648 on Yade changed:
https://answers.launchpad.net/yade/+question/696648

    Status: Open => Answered

Jan Stránský proposed the following answer:
> Backtrace:
> /home/mithu/myYade/trunk/install/lib/x86_64-linux-gnu/yade-Unknown/libdem.so(_ZN4yade13DeformControl6actionEv+0x93)[0x7feb6444a173]

This is the problem, inside DeformControl::action [3], specifically here [4] (and below following the same logic with b[i]->...).
b ... body container (like O.bodies in Python)
i ... some index
b[i] ... i-th body. But after O.bodies.erase b[i] it is possibly nullptr (None in Python). The null-ity is not checked (but it should be to work with O.bodies.erase)
b[i]-> ... some operation with the body. But if the body is erased, b[i] is nullptr and it ends with segmentation fault.

If you want it to be fixed, you can:
- fix it yourself
- report an issue on gitlab (referencing this question)

Similar questions (O.bodies.erase and then segmentation fault) arises
from time to time, with always the same reason - some piece of Yade C++
code not considering the possibility of erased bodies, maybe the topic
deserves a FAQ.

Cheers
Jan

[3] https://gitlab.com/yade-dev/trunk/-/blob/master/pkg/dem/ViscoelasticPM.cpp#L408
[4] https://gitlab.com/yade-dev/trunk/-/blob/master/pkg/dem/ViscoelasticPM.cpp#L415

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.