Hi Paul,

On 11/28/06, Paul Martz <[EMAIL PROTECTED]> wrote:
NodeVisitor derives from Referenced, yet ~NodeVisitor() is declared with
public visibility. Shouldn't this be changed to protected?

This is actually deliberate.

Often you'll want to use a NodeVisitor on the stack, as a locally
declared objects that you just use straight off and don't need to both
with ref counting.  For these cases you need the destructor public.

Other times you'll want to treat the NodeVisitor as an object on the
heap that you pass around, and even share.  Things like the
CullVisitor are examples of this.  For this usage you need it to be
subclassed from osg::Referenced.

The only way to server both these usage models is to bend the rule on
making the destructor protected.  osgProducer::Viewer is another
example where the rule is bent for exactly the same reasons.

Now one could be really strict about the protected destructor, but all
i get you in these cases is more code to write and maintain for the
cases when ref counting isn't needed.

Scene graph objects are a different issue though, you always want to
create them on the heap, so protected destructor is most definitely
the thing to do.

I've fired off a build with this change to check it, but it'll be a while
before everything compiles...

Well lots of code won't compile...

If there are little oddities like this in the OSG just raise them,
sometimes it'll be a good reason for it, other times it might just be
a sloppy error that crept in.

Robert.
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to