HI Gianni,

My guess would be that you've introduced a threading bug by
creating/destroying state objects in the scene graph whilst it's being
rendered.

If you want to toggle on/off behavior like this considering using a
NodeMask on the wireframe portion of the subgraph and just toggle the
wireframe version on/off as required by sett the Node::setNodeMask() to 0x
and 0xffffffff to switch it off/on respectively.

If you do want to create/destroy state then just make sure you are using a
ref_ptr<> to any objects you want to keep around and reuse a C pointer will
just end up a dangling pointer when your remove the object it's pointing to
from the scene graph.

Robert.


On 26 August 2014 14:28, Gianni Ambrosio <[email protected]> wrote:

> Hi,
> unfortunately now I found an unexpected behavior with the non-osgFX
> solution. Pushing wireframe button on and off quite fast from my
> application I get sometimes a crash, sometimes the surface disappears and I
> can see just the wireframe (there's no way to get the surface visible
> again). OSG 3.1.4 are used in this case.
>
> The crash happens at the end of this piece of code (osg/State):
>
>
> Code:
>
>         inline bool applyAttribute(const StateAttribute*
> attribute,AttributeStack& as)
>         {
>             if (as.last_applied_attribute != attribute)
>             {
>                 if (!as.global_default_attribute.valid())
> as.global_default_attribute =
> dynamic_cast<StateAttribute*>(attribute->cloneType());
>
>                 as.last_applied_attribute = attribute;
>                 attribute->apply(*this);
>
>
>
> And here is the call stack:
>
>
> Code:
>         osg95-osgd.dll!osg::State::applyAttribute(const
> osg::StateAttribute * attribute, osg::State::AttributeStack & as)  Line
> 1596 + 0xe bytes        C++
>
> osg95-osgd.dll!osg::State::applyAttributeList(std::map<std::pair<enum
> osg::StateAttribute::Type,unsigned
> int>,osg::State::AttributeStack,std::less<std::pair<enum
> osg::StateAttribute::Type,unsigned int>
> >,std::allocator<std::pair<std::pair<enum
> osg::StateAttribute::Type,unsigned int> const ,osg::State::AttributeStack>
> > > & attributeMap, const std::map<std::pair<enum
> osg::StateAttribute::Type,unsigned
> int>,std::pair<osg::ref_ptr<osg::StateAttribute>,unsigned
> int>,std::less<std::pair<enum osg::StateAttribute::Type,unsigned int>
> >,std::allocator<std::pair<std::pair<enum
> osg::StateAttribute::Type,unsigned int> const
> ,std::pair<osg::ref_ptr<osg::StateAttribute>,unsigned int> > > > &
> attributeList)  Line 2324        C++
>         osg95-osgd.dll!osg::State::apply(const osg::StateSet * dstate)
> Line 508        C++
>         osg95-osgUtild.dll!osgUtil::RenderLeaf::render(osg::RenderInfo &
> renderInfo, osgUtil::RenderLeaf * previous)  Line 47 + 0x14 bytes      C++
>
> osg95-osgUtild.dll!osgUtil::RenderBin::drawImplementation(osg::RenderInfo &
> renderInfo, osgUtil::RenderLeaf * & previous)  Line 483 + 0x19 bytes
> C++
>
> osg95-osgUtild.dll!osgUtil::RenderStage::drawImplementation(osg::RenderInfo
> & renderInfo, osgUtil::RenderLeaf * & previous)  Line 1398  C++
>         osg95-osgUtild.dll!osgUtil::RenderBin::draw(osg::RenderInfo &
> renderInfo, osgUtil::RenderLeaf * & previous)  Line 428 + 0x17 bytes
> C++
>         osg95-osgUtild.dll!osgUtil::RenderStage::drawInner(osg::RenderInfo
> & renderInfo, osgUtil::RenderLeaf * & previous, bool & doCopyTexture)  Line
> 933      C++
>         osg95-osgUtild.dll!osgUtil::RenderStage::draw(osg::RenderInfo &
> renderInfo, osgUtil::RenderLeaf * & previous)  Line 1237 + 0x1b bytes   C++
>         osg95-osgUtild.dll!osgUtil::SceneView::draw()  Line 1443 + 0x37
> bytes   C++
>         osg95-osgViewerd.dll!osgViewer::Renderer::draw()  Line 732 + 0xf
> bytes  C++
>
> osg95-osgViewerd.dll!osgViewer::Renderer::operator()(osg::GraphicsContext *
> context)  Line 899 + 0xf bytes      C++
>         osg95-osgd.dll!osg::GraphicsContext::runOperations()  Line 777 +
> 0x33 bytes     C++
>         osg95-osgQtd.dll!osgQt::GraphicsWindowQt::runOperations()  Line
> 685 + 0xb bytes C++
>         osg95-osgd.dll!osg::RunOperations::operator()(osg::GraphicsContext
> * context)  Line 137 + 0xf bytes     C++
>         osg95-osgd.dll!osg::GraphicsOperation::operator()(osg::Object *
> object)  Line 53 + 0x19 bytes   C++
>         osg95-osgd.dll!osg::OperationThread::run()  Line 426 + 0x26 bytes
>      C++
>         osg95-osgd.dll!osg::GraphicsThread::run()  Line 41      C++
>
> ot12-OpenThreadsd.dll!OpenThreads::ThreadPrivateActions::StartThread(void *
> data)  Line 113 + 0xf bytes C++
>         msvcr100d.dll!_callthreadstartex()  Line 314 + 0xf bytes        C
>         msvcr100d.dll!_threadstartex(void * ptd)  Line 297      C
>
>
>
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=60793#60793
>
>
>
>
>
> _______________________________________________
> 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