[osg-users] osg::observer_ptr and osg::ref_ptr

Robert Osfield robert.osfield at gmail.com
Thu Oct 18 12:25:46 PDT 2018


HI Kristofer,

There is an intermediate ObserveSet object that both the object being
observed and the observer_ptr<> share, the the observed gets deleted it
resets the ObserverSet so that when then the observer_ptr<> is accessed it
can check to see if the pointer is still valid.

The ObserverSet is created on demand behind the scenes, you don't need to
worry it's management, just use observer_ptr<> and things will be set up
automatically for you :-)

Robert,

On Thu, 18 Oct 2018 at 18:00, Kristofer Krus <kristofer.krus at liu.se> wrote:

> Seems handy!
>
> So how can nodeObs become NULL when the Node object is deleted? Does the
> latter store a list of the observer_ptr objects that it is observed by, and
> set them all to NULL when it is destructed? Or how does it work?
>
> Cheers,
> Kristofer
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=75092#75092
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20181018/415f1e54/attachment.html>


More information about the osg-users mailing list