Thank you Robert, it was exactly what you said, I call stopThreading before
removing and call startThreading after and everything is apparently working
fine, no more crash.

I wonder why stopThreading and startThreading aren't call in
CompositeViewer::removeView
??

2008/6/23 Robert Osfield <[EMAIL PROTECTED]>:

> Hi Alex,
>
> The bug is very unlikely to be related directly to the event handlers,
> please check if that are any threads running on the viewer, if there
> are then you have to stop them before removing anything from the
> viewer.  Note, viewer.stopThreading(); is what you'll need to call
> before you do removeView.
>
> Robert.
>
> On Mon, Jun 23, 2008 at 2:57 PM, amalric alexandre
>  <[EMAIL PROTECTED]> wrote:
> > Hi Robert,
> >
> > what seems strange to me is that I add other event handler like for
> example
> > a custom stats handler or a osgGA::StateSetManipulator wich are derived
> from
> > the same class as the LODScaleHandler (ie: osgGA::GUIEventHandler). And
> with
> > those 2 others event handler everything is working fine, it only crashes
> if
> > I add the Lod handler.
> >
> > I agree with you that this class is not very complicated but I do not
> > understand why this one fails to unref.
> >
> > I try to track down the bug but I'm not sure it's on my application side,
> > I'm unable to find the difference between a simple LODScaleHandler and a
> > simple StatsHandler for example.
> >
> > Kind regards,
> >
> > 2008/6/23 Robert Osfield <[EMAIL PROTECTED]>:
> >>
> >> Hi Alex,
> >>
> >> The LODScaleHandler looks prefectly correct, and given how simple this
> >> event handler is I very much doubt the the problems stems from here.
> >>
> >> Could something else be corrupting the pointer?  Could it be that you
> >> are deleting parts of the viewer while other threads are still using
> >> it?
> >>
> >> Robert.
> >>
> >> On Mon, Jun 23, 2008 at 2:30 PM, amalric alexandre
> >> <[EMAIL PROTECTED]> wrote:
> >> > Hi osg-users,
> >> >
> >> > I've noticed something strange in my app, I have a composite viewer
> with
> >> > multiple view that I can add or remove at run-time. When I do not use
> a
> >> > LODScaleHandler everything works fine when I remove my views from
> >> > composite
> >> > viewer.
> >> >
> >> > But when I use a LODScaleHandler as :
> >> > rpView->addEventHandler(new osgViewer::LODScaleHandler());
> >> >
> >> > My application crashes when I remove a view from composite viewer with
> >> > current stack:
> >> >
> >> >> osg38-osgd.dll!osg::Referenced::unref()  Ligne 155 + 0x23 octets C++
> >> >
> >> >
> osg38-osgViewerd.dll!osg::ref_ptr<osgGA::GUIEventHandler>::~ref_ptr<osgGA::GUIEventHandler>()
> >> > Ligne 30 + 0x33 octets C++
> >> >
> >> >
> osg38-osgViewerd.dll!std::_List_nod<osg::ref_ptr<osgGA::GUIEventHandler>,std::allocator<osg::ref_ptr<osgGA::GUIEventHandler>
> >> >> >::_Node::~_Node()  + 0x19 octets C++
> >> >
> >> >
> osg38-osgViewerd.dll!std::_List_nod<osg::ref_ptr<osgGA::GUIEventHandler>,std::allocator<osg::ref_ptr<osgGA::GUIEventHandler>
> >> >> >::_Node::`scalar deleting destructor'()  + 0x16 octets C++
> >> >
> >> >
> osg38-osgViewerd.dll!std::_Destroy<std::_List_nod<osg::ref_ptr<osgGA::GUIEventHandler>,std::allocator<osg::ref_ptr<osgGA::GUIEventHandler>
> >> >>
> >>
> >> >>
> >>::_Node>(std::_List_nod<osg::ref_ptr<osgGA::GUIEventHandler>,std::allocator<osg::ref_ptr<osgGA::GUIEventHandler>
> >> >> >::_Node * _Ptr=0x032ef1c8)  Ligne 61 C++
> >> >
> >> >
> osg38-osgViewerd.dll!std::allocator<std::_List_nod<osg::ref_ptr<osgGA::GUIEventHandler>,std::allocator<osg::ref_ptr<osgGA::GUIEventHandler>
> >> >>
> >>
> >> >>
> >>::_Node>::destroy(std::_List_nod<osg::ref_ptr<osgGA::GUIEventHandler>,std::allocator<osg::ref_ptr<osgGA::GUIEventHandler>
> >> >> >::_Node * _Ptr=0x032ef1c8)  Ligne 161 + 0x9 octets C++
> >> >
> >> >
> osg38-osgViewerd.dll!std::list<osg::ref_ptr<osgGA::GUIEventHandler>,std::allocator<osg::ref_ptr<osgGA::GUIEventHandler>
> >> >> >::clear()  Ligne 827 C++
> >> >
> >> >
> osg38-osgViewerd.dll!std::list<osg::ref_ptr<osgGA::GUIEventHandler>,std::allocator<osg::ref_ptr<osgGA::GUIEventHandler>
> >> >> >::_Tidy()  Ligne 1185 C++
> >> >
> >> >
> osg38-osgViewerd.dll!std::list<osg::ref_ptr<osgGA::GUIEventHandler>,std::allocator<osg::ref_ptr<osgGA::GUIEventHandler>
> >> >>
> >>
> >> >>
> >>::~list<osg::ref_ptr<osgGA::GUIEventHandler>,std::allocator<osg::ref_ptr<osgGA::GUIEventHandler>
> >> >> >()  Ligne 516 C++
> >> >   osg38-osgViewerd.dll!osgViewer::View::~View()  Ligne 170 + 0x2d
> octets
> >> > C++
> >> >   osg38-osgViewerd.dll!osgViewer::View::`vbase destructor'()  + 0x17
> >> > octets C++
> >> >   Px-Viewer.exe!osgViewer::View::`scalar deleting destructor'()  +
> 0x2e
> >> > octets C++
> >> >   osg38-osgd.dll!osg::Referenced::unref()  Ligne 155 + 0x23 octets C++
> >> >
> >> >
> osg38-osgViewerd.dll!osg::ref_ptr<osgViewer::View>::~ref_ptr<osgViewer::View>()
> >> > Ligne 30 + 0x33 octets C++
> >> >   osg38-osgViewerd.dll!osg::ref_ptr<osgViewer::View>::`scalar deleting
> >> > destructor'()  + 0x16 octets C++
> >> >   osg38-osgViewerd.dll!std::_Destroy<osg::ref_ptr<osgViewer::View>
> >> >>(osg::ref_ptr<osgViewer::View> * _Ptr=0x032d47f8)  Ligne 61 C++
> >> >   osg38-osgViewerd.dll!std::allocator<osg::ref_ptr<osgViewer::View>
> >> >>::destroy(osg::ref_ptr<osgViewer::View> * _Ptr=0x032d47f8)  Ligne 161
> +
> >> >> 0x9
> >> > octets C++
> >> >
> >> >
> osg38-osgViewerd.dll!std::_Destroy_range<osg::ref_ptr<osgViewer::View>,std::allocator<osg::ref_ptr<osgViewer::View>
> >> >> >(osg::ref_ptr<osgViewer::View> * _First=0x032d47f8,
> >> > osg::ref_ptr<osgViewer::View> * _Last=0x032d47fc,
> >> > std::allocator<osg::ref_ptr<osgViewer::View> > & _Al={...},
> >> > std::_Nonscalar_ptr_iterator_tag __formal={...})  Ligne 235 + 0xc
> octets
> >> > C++
> >> >
> >> >
> osg38-osgViewerd.dll!std::_Destroy_range<osg::ref_ptr<osgViewer::View>,std::allocator<osg::ref_ptr<osgViewer::View>
> >> >> >(osg::ref_ptr<osgViewer::View> * _First=0x032d47f8,
> >> > osg::ref_ptr<osgViewer::View> * _Last=0x032d47fc,
> >> > std::allocator<osg::ref_ptr<osgViewer::View> > & _Al={...})  Ligne 226
> +
> >> > 0x28 octets C++
> >> >
> >> >
> osg38-osgViewerd.dll!std::vector<osg::ref_ptr<osgViewer::View>,std::allocator<osg::ref_ptr<osgViewer::View>
> >> >> >::_Destroy(osg::ref_ptr<osgViewer::View> * _First=0x032d47f8,
> >> > osg::ref_ptr<osgViewer::View> * _Last=0x032d47fc)  Ligne 1083 + 0x14
> >> > octets C++
> >> >
> >> >
> osg38-osgViewerd.dll!std::vector<osg::ref_ptr<osgViewer::View>,std::allocator<osg::ref_ptr<osgViewer::View>
> >> >>
> >>
> >> >>
> >>::erase(std::_Vector_iterator<osg::ref_ptr<osgViewer::View>,std::allocator<osg::ref_ptr<osgViewer::View>
> >> >> > _Where={_ptr=0x032cee88 })  Ligne 989 C++
> >> >
> >> >
> osg38-osgViewerd.dll!osgViewer::CompositeViewer::removeView(osgViewer::View
> >> > * view=0x032cee88)  Ligne 147 + 0x23 octets C++
> >> >
> >> >
> >> > --
> >> > Alexandre AMALRIC Ingénieur R&D
> >> > ===================================
> >> > PIXXIM S.A. 73E, rue Perrin-Solliers 13006 Marseille
> >> > http://www.pixxim.fr
> >> >
> >> >
> >> >
> >> >
> >> > _______________________________________________
> >> > 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
> >
> >
> >
> > --
> > Alexandre AMALRIC Ingénieur R&D
> > ===================================
> > PIXXIM S.A. 73E, rue Perrin-Solliers 13006 Marseille
> > http://www.pixxim.fr
> > _______________________________________________
> > 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
>



-- 
Alexandre AMALRIC Ingénieur R&D
===================================
PIXXIM S.A. 73E, rue Perrin-Solliers 13006 Marseille
http://www.pixxim.fr
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to