Hi Can, The problem sounds like your use of smart pointer is not robust/appropriate, its not an OSG issue but memory management issue in your own subclass.
The OSG doesn't have a weak_ptr<> so where did you source it? Also why use a weak_ptr<> over a a shared_ptr<> or osg::ref_ptr<>? When something owns an object you should use a osg::ref_ptr<>, and the relationship you describe suggest that it should be a ref_ptr<>. Robert. On 6/1/06, The Ephemera <[EMAIL PROTECTED]> wrote:
Hi all, I am relatively new to OSG so please excuse me if this is a dumb question. I implemeted a class inherited from osg::Drawable called TriMeshRenderer, and this class holds a smart pointer (a weak_ptr) to some mesh data class. The boundingbox calculation and rendering is done through accessing the mesh data from the smart pointer. But when the scenegraph calls the destructor of MeshRenderer (either because the window is destroyed or the scene view is reset), the program throws access violation. It seems as if the use of smart pointer in computeBound() is causing the problem since when I commented out the body of code here and simply return _boundingBox, there's no problem any more. But I just don't see why. Is there any routine job needed to be done in destructor of a class inherited from Drawable? Anyone can shed some light on this? Thanks. -- Best regards, Can Zheng _______________________________________________ osg-users mailing list [email protected] http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/
_______________________________________________ osg-users mailing list [email protected] http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/
