Hi Glenn,

Your analysis is correct, when the DatabaseCacheReadCallback is
deployed  one can potentially end up with dangling pointers.
Switching to ref counted NodePath would be the safest way to fix this.
 There is a performance penalty though, which is why a straight
NodePath was used.  There is no easy way around this though, as
"clever" schemes can easily come undone.

Robert.

On Nov 13, 2007 8:59 PM, Glenn Waldron <[EMAIL PROTECTED]> wrote:
> Robert,
>
> Thanks for your response. I see what you mean, that under normal
> circumstances the children of a PagedLOD are guaranteed to stick around
> until at least the next update traversal.
>
> However I think there is still an issue here. The
> IntersectionVisitor::ReadCallback allows you to bypass the database pager's
> normal mechanism and load PagedLOD children manually so to speak. This is
> exactly what the osgSim::DatabaseCacheReadCallback does. It loads children
> and puts them in a cache rather than in the scene graph. Since they're not
> in the scene graph, their lifespan is not tied to the pager. When the cache
> reaches maximum size and starts pruning nodes, a node that might have been
> previously stored in an Intersection's nodePath could get dereferenced and
> destroyed.
>
> I tested this by changing the type of
> LineSegmentIntersector::Intersection::nodePath to a osg::NodeList. This
> resolved the crash I was seeing.
>
> If you agree with this analysis, I will be happy to submit a fix. If I'm
> missing something obvious I will go away :) I think PlaneIntersector and
> PolytopeIntersector exhibit the same issue BTW. -gw
>
>
>
> On Nov 13, 2007 3:04 PM, Robert Osfield <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> > Hi Glenn,
> >
> > Its a "potential" problem but for most part won't be if you use the
> > OSG sensibly - the addition and removal of subgraphs via PagedLOD is
> > done single threaded as part of the update traversal so as long as you
> > don't run code multi-threaded with this you should be fine.
> >
> > If your NodePath lives longer than a frame then you'll need to convert
> > it into a Ref converted NodePath
> >
> > Robert.
> >
> >
> >
> >
> >
> > On Nov 13, 2007 4:49 PM, Glenn Waldron <[EMAIL PROTECTED]> wrote:
> > > Another intersection-related question for the group:
> > >
> > > LineSegmentIntersector::Intersection contains a "nodePath" member.
> However,
> > > the osg::NodePath is a simple osg::vector<Node*> that doesn't use
> ref_ptr's.
> > > So I'm not convinced that by the time you are finished intersecting,
> that
> > > nodePath member contains valid references.
> > >
> > > I mention this because I'm trying to use that nodePath and getting
> crashes
> > > that look suspiciously like the kind you get when you reference deleted
> > > objects. The problem only arises when traversing PagedLOD nodes (since
> those
> > > nodes aren't guaranteed to stay resident).
> > >
> > > Thanks again. -gw
> > >
> > > --
> > > Glenn Waldron : Pelican Mapping : http://pelicanmapping.com :
> 703-652-4791
> > > _______________________________________________
> > > 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
> >
>
>
>
> --
>
>
> Glenn Waldron : Pelican Mapping : http://pelicanmapping.com : 703-652-4791
> _______________________________________________
> 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

Reply via email to