Hi Farshid,

On 17 November 2011 02:55, Farshid Lashkari <[email protected]> wrote:
> I've attached a small optimization to
> osgDB::Registry::removeExpiredObjectsInCache that removes the expired items
> while iterating over the cache, instead of saving to a temporary vector and
> then removing.

I've just reviewed you change to
osgDB::Registry::removeExpiredObjectsInCache and believe that the line

   _objectCache.erase(oitr++);

Relies upon the oitr iterator being copied then incremented, then the
copy being passed to _objectCache.  I don't know the exact C++ rule on
this, it might be required to be ordered this way by definition, but
the code does make me a little nervous that the erase might be done
first then the increment.  If the later is done then you'd be
incrementing on iterator that has already been invalidated.  Before I
merge any of these changes we'll need to nail down that what you
attempting is a 100% robust on all compilers.  If there is any doubt
then copying the iterator explictly, then incrementing the iterator
would be the thing to do.

Thoughts?
Robert.
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to