[osg-users] Crash in Camera::setRenderer()

Nicolas Baillard nicolas.baillard at gmail.com
Tue Jun 9 05:00:07 PDT 2015

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 ?


Read this topic online here:

More information about the osg-users mailing list