Hi Nicolas,

Are you using C pointers or ref_ptr<> when keeping reference around
the to the slave Camera?  If you use a C* pointer then there is good
chance that the reference count on the Camera is going to zero when
it's removed from the View and getting deleted, then you add that
dangling pointer back to the View and bang your get a crash there
after.

That's my best guess given I don't have any code in front of me.

Robert.

On 9 June 2015 at 13:00, Nicolas Baillard <[email protected]> wrote:
> Hello everyone.
>
> In my application I create several views and several cameras. Upon user 
> interaction each camera can be added or removed from a view using 
> View::addSlave() and View::removeSlave().
> My code ensures that each camera is only assigned to only one view at a time. 
> A camera can't be assigned to another view before being removed from the view 
> it currently is.
> When I do that I often get a crash in the Camera::setRenderer() method that 
> is called by addSlave().
>
> The crash happen into GraphicsOperation destructor. When a camera is added to 
> a view with addSlave() a new renderer is created for it. If the camera 
> already has a renderer that renderer is automatically deleted by the 
> reference counting pointer. That's when the crash happen. It looks like the 
> renderer (or maybe one of its members) is deleted twice.
>
> I'm not using multithreading. I don't change camera assignation during 
> rendering with callbacks. Camera assignation is all done outside of the 
> CompositeViewer::frame() method.
>
> Do you have any idea what might be causing this crash ?
>
> Regards,
> Nicolas
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=64003#64003
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to