Hi Baker, On 22 November 2013 15:55, Bradley Baker Searles <bakersear...@gmail.com>wrote:
> I agree the osgDB::readRef*File() functions are safe. I was only noting > that the osgDB::readRef*File() functions that return raw pointers are used > in more than just Input.cpp and the deprecated wrappers as you'd mentioned. > I think you mean read*File() there :-) > As for whether using the take methods invalidate the reference count, I > think we're arguing semantics. I do not consider a reference counted object > to be properly reference counted if there are raw pointers to it being kept > and used (performance critical situations excepted). > Absolutely not semantics. I'm talking specifically about the reference count value in osg::Referenced, the ref_ptr<>::release() decrements the reference count, resets the ref_ptr<> to 0 so keeps it self consistent. Raw pointers don't invalidate any reference count, they are simply raw pointers and it's important to remember that that using them has no effect on the reference counting and no guaranteed memory safety with it. Use C pointers and you really need to be careful. Code like Input.cpp and any other parts of the OSG that use the thread unsafe read*File() really need to be updated. Tackling this is probably best done collectively as it's quite sweeping work across plugins. Robert.
_______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org