Hi Pjotr,

Comments below:

On 8 January 2013 14:22, Pjotr Svetachov <[email protected]> wrote:
> 2) Another rare crash in renderer in the
> collateReferencesToDependentCameras or
> clearReferencesToDependentCameras functions: if you set the nodemask
> of the main or the slave camera to zero and then delete a
> render-to-texture camera from the scene it could crash. It took me a
> while to find out what the problem was because those two function are
> there to prevent crashes on camera deletion in the first place. The
> problem is that those two methods collect all the camera's from the
> render stages. What happens is that when the node mask is zero the
> cull stage is skipped and the render stages are not updated (or reset)
> so in that case those two methods will work on outdated data which
> includes outdated camera pointers. To fix this you can skip the
> collecting of rtt camera references if the nodemask is zero as the
> draw phase is skipped anyway.

I've been looking at the
SceneView::collateReferencesToDependentCameras() method which uses the
RenderStage::collateReferencesToDependentCameras(), these methods
outwardly look safe except for the potential for a dangling
RenderStage::_camera pointer.  While I haven't reproduced the problem
you are trying to address this does look like a reasonable candidate
for the cause of the crash.

If this dangling RenderStage::_camera is the problem then using a
osg::observer_ptr<> would be the solution.  i.e in
include/osgUtil/RenderStage header we'd change the

        osg::Camera*                        _camera;

To:

        osg::observer_ptr<Camera>  _camera;


Could you try this out and see if it fixes the problem?   If this
fixes the problem then I'll merge this change.

Robert.
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to