This bug is now fixed in r4494. Thanks for reporting.

Your patch relies on implementation details of the iterators which may
change in future, so instead  created a temporary vector in the first
loop, and then deleted the atoms in the vector.

- Noel

On 27 May 2011 13:28, My Th <rei4...@gmail.com> wrote:
> I think what I'm doing in that patch is legal and well defined.
>
> DeleteAtom basically does this:
> _vatom.erase(_vatom.begin()+(atom->GetIdx()-1));
>
> where _vatom is a vector of pointers to atoms. When the element of the
> vector is deleted then all the iterators and references to elements
> __after__ the position of the removed element become invalid. So if I
> decrement the iterator back to the last unchanged position and then
> increment it again it should point to the next element after the removed
> one, and it does.
>
>
> Reinis
>
> Pk, 2011-05-27 12:49 +0100, Noel O'Boyle rakstīja:
>> Regarding Patch 3196285, AFAIK, all of our iterators are undefined
>> when you call DeleteAtom (this is a C++ idiom). The recommended way of
>> doing this is to append the atom to be deleted to a vector, and then
>> delete all members of the vector once the loop is over.
>>
>> Anyone else?
>>
>> - Noel
>>
>> On 27 May 2011 12:14, My Th <rei4...@gmail.com> wrote:
>> > Hi!
>> >
>> > A while ago I posted these patches in the tracker:
>> > https://sourceforge.net/tracker/?func=detail&aid=3196280&group_id=40728&atid=428742
>> > https://sourceforge.net/tracker/?func=detail&aid=3196285&group_id=40728&atid=428742
>> >
>> > The first one fixes indexing in obutil.cpp::InternalToCartesian(), the
>> > second one fixes removal of dummy atoms in the same function.
>> >
>> > Before the code for removing dummy atoms never was executed and dummy
>> > atoms were not removed. These patches fixes that, so the dummy atoms are
>> > removed when the function obutil.cpp::InternalToCartesian() is called.
>> >
>> > These patches still are not committed. Is there some technical reason
>> > for that? Could they be applied before the next point release of OB?
>> >
>> >
>> > Regards,
>> > Reinis
>> >
>> >
>> > ------------------------------------------------------------------------------
>> > vRanger cuts backup time in half-while increasing security.
>> > With the market-leading solution for virtual backup and recovery,
>> > you get blazing-fast, flexible, and affordable data protection.
>> > Download your free trial now.
>> > http://p.sf.net/sfu/quest-d2dcopy1
>> > _______________________________________________
>> > OpenBabel-Devel mailing list
>> > OpenBabel-Devel@lists.sourceforge.net
>> > https://lists.sourceforge.net/lists/listinfo/openbabel-devel
>> >
>
>
>

------------------------------------------------------------------------------
vRanger cuts backup time in half-while increasing security.
With the market-leading solution for virtual backup and recovery, 
you get blazing-fast, flexible, and affordable data protection.
Download your free trial now. 
http://p.sf.net/sfu/quest-d2dcopy1
_______________________________________________
OpenBabel-Devel mailing list
OpenBabel-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-devel

Reply via email to