On Wed, Jun 24, 2009 at 10:12 PM, Judd Tracy<j...@thetracys.net> wrote: > You could always attach a create your own DeleteHandler and attach it to the > node, but I don't know if that will help you other then letting you know it > is going to be deleted. > > On Wed, Jun 24, 2009 at 11:58 AM, <paul1...@yahoo.com> wrote: >> >> What is the easiest way to determine if a particular node is being deleted >> from memory? I have a relatively complex scene and part of the scene needs >> to be deleted and reconstructed at times. I'm concerned there might be a >> memory leak and that some of my nodes are not being freed because we aren't >> using ref_ptr where we need them. >> >> Paul P. >> >> >> >> _______________________________________________ >> osg-users mailing list >> osg-users@lists.openscenegraph.org >> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > > _______________________________________________ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > >
Did you try: template<typename T> struct MyObj : T { ~MyClass() { // handle deletion; output something to stderr, console, debugger, file, etc. } }; { osg::ref_ptr<MyObj<osg::Group> > pobj = new osg::Group; // use pobj } // should call destructor here. Instead of a template class, you may derive directly from osg::Referenced or osg::Object as the most common base types, but then you lose full functionality of actual type and need to cast. I didn't test the code (have no osg neither a compiler on my Omnia PDA), but I'd expect that to work regardless of project, as long as base type has a virtual destructor and gets deleted (in case delete is applied onto pointer to base type, which is the case in osg). Ismail _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org