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

2015-06-09 Thread Robert Osfield
Hi Nicolas,

On 9 June 2015 at 14:04, Nicolas Baillard  wrote:
> I keep my cameras and views using ref_prt<>. They are all created when the 
> application starts and never deleted.

That probably rules out dangling pointers then.  Which leaves me with
no particular idea what might be wrong.

As a long shot you could look at the OSG version you are using.  I
don't know what version you are using by OSG svn/trunk and OSG-3.3.x
dev series have a range of fixes that might address problems.

> I'm working on a minimal piece of code to reproduce the crash.

Thanks,
Robert.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


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

2015-06-09 Thread Nicolas Baillard
Thank you Robert.

I keep my cameras and views using ref_prt<>. They are all created when the 
application starts and never deleted.

I'm working on a minimal piece of code to reproduce the crash.

Nicolas

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=64008#64008





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


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

2015-06-09 Thread Robert Osfield
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  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
> 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


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

2015-06-09 Thread Nicolas Baillard
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
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org