Hi Louis,

Louis Bouchard wrote:
> it's a osg::Program*.  The thing is, after the call to
> removeAttribute(), the osg::Program* is still valid.  The object has
> not been deleted, and the pointer is certainly not null.  I checked.
> Unless something inside the osg::Program structure has been screwed
> with.

How did you check that the object hasn't been deleted?  The fact that the 
pointer is not
null doesn't really tell you anything, the object could still have been deleted 
and you
now have a pointer to invalid memory (that can still *look* valid because it 
hasn't been
zeroed).

> I don't see how ref_ptrs are necessary in that case.  I understand why

As soon as you hand the pointer to a osg::ref_ptr<> (which is basically any OSG 
object)
and you also want to keep a pointer yourself you should use them.

Why don't you give it a try and see if the problem is resolved?  It's probably 
a trivial
change.

Personally I'm absolutely in love with std::tr1::shared_ptr<> and RAII; you 
have to take
care for circular references but apart from that memory leaks and such are 
completely
eliminated.

Cheers,
/ulrich
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to