On Dec 12, 2007 11:34 AM, Robert Osfield <[EMAIL PROTECTED]> wrote: > Hi Serge, > > Thanks for the explanation, this really does help. You suggest change > to DatabasePager.cpp to use ReadResult rather than > osgDB::readNodeFile() is an interesting one. While the getting the > timing to reproduce the crash seems pretty rare it is certainly > possible, but often any little opening for a multi-threading crash can > come out and bite, even if its seems really unlikely. > > My current though is the weakness you've highlights is that > osgDB::readNodeFile() doesn't return a ref_ptr<>, opening the door to > the object being unref'd at the same time as the C pointer is be > passed back from readNodeFile. Changing readNodeFile to pass back a > ref_ptr<> is a possibility, but it'd break a lot of user code - this > might be the right thing to do in terms of writing robust C++, but it > is a heavy hit to force on users that don't code stuff in ways that > would be sensitive to this issue. > > Perhaps a readRefNodeFile that passes back a ref_ptr<> would be a > workaround. I guess one might be able to write a little class to work > as adapter too so one could pass this object back and it work for C* > as well as ref_ptr<> but this would be a pretty obscure use of C++. > > Thoughts? > > The readRefNodeFile seems a good option, moving the criticals readNodeFile to it. The osgText part will need a little bit more of refactoring, moving all the part where a C pointer is passed to a ref_ptr. If you want I can do the changes this afternoon if we decide to go this way. :)
-- Serge Lages http://www.tharsis-software.com
_______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

