[osg-users] Potential crash in ObjectCache::removeExpiredObjectsInCache
Robert Osfield
robert.osfield at gmail.com
Sat May 5 04:49:40 PDT 2018
Hi Guy,
I have look into the build issue and your proposed change. Your
proposed changes requires C++11, while the original code uses the
standard pre C++11 method to erasing an element of std::map<>. I
believe the original code should be fine, for it not to work then
there must be an issue with the increment operation implementation
order or operation or for all iterators to the map being invalidated
by the erase. It sounds like your compiler is tripping up on this.
The best solution I can come up with is:
#if __cplusplus > 199711L
oitr = _objectCache.erase(oitr);
#else
_objectCache.erase(oitr++);
#endif
I've checked the into the 3.6 branch and master:
https://github.com/openscenegraph/OpenSceneGraph/commit/d95993554e08d9d10b6f4a4f4d6e74bbd1a7f3be
Could you test this and let me know how you get on.
Cheers,
Robert.
More information about the osg-users
mailing list