-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document proper usage of BipedalLocomotion::Contacts::ContactList::editContact() #847
Comments
The problem is that bipedal-locomotion-framework/src/Contacts/src/ContactList.cpp Lines 208 to 209 in e341b70
might invalidate existing iterators. It should be at least documented. It would be even better if we avoid to have this issue at all |
What about something as follows:
bipedal-locomotion-framework/src/Contacts/include/BipedalLocomotion/Contacts/ContactList.h Lines 207 to 208 in e341b70
to
to
This should have the effect of changing the Could it work? If it works, then we should change also the way
|
Unfortunately, I don't think so. The |
I see your point, which in fact is also reported in the c++ documentation. Though, in the
where iterators get erased within a for loop, which cycles on the iterators themselves. |
I see. In any case, this would fix the issue with the iterator to the item that has been edited. The problem is if you have other iterators around. Those could also become invalid. |
The function BipedalLocomotion::Contacts::ContactList::editContact might cause segmentation fault if used within loops, such as for loops.
For example the following pseudo-code:
@S-Dafarra pointed out the it could be due to these lines.
It should be documented that this function should not be used within loops.
The text was updated successfully, but these errors were encountered: