[osg-users] Assertion failure - using removeChild

Vincent Bourdier vincent.bourdier at gmail.com
Thu Mar 13 01:35:38 PDT 2008


Hi,

Have you checked all the variables ? I have encountered the problem because
my Node was not good... sometimes you get an error but it is another bug in
your code...
Try to verify each variable (in debug mode for example (step-by-step)) and
you'll find your problem.

I don't think it is an OSG problem...

Regards,
   Vincent.

2008/3/13, Renan Mendes <renanmzmendes at gmail.com>:
>
> Hi, everyone.
>
> I wrote the following code:
>
> case(osgGA::GUIEventAdapter::KEYDOWN):
>             {
>                 if(ea.getKey() == ea.KEY_Delete)
>                 {
>                     if(!vprim.empty())
>                     {
>                         vprim_itr = vprim.begin();
>                         while(vprim_itr != vprim.end())
>                         {
>                             if((*vprim_itr)->checkSelection()) // No
> problems in this line
>                             {
>                                 // HERE'S WHERE THE PROBLEM IS
>
> root->removeChild(root->getChildIndex((*vprim_itr)), 1);
>                                 vprim_itr = vprim.erase(vprim_itr);
>                             }
>
>                             else
>                             {
>                                 vprim_itr++;
>                             }
>                         }
>                     }
>                 }
>             }
>
> where vprim is a STL vector and vprim_itr its iterator. When using the
> combination of the two lines below the commentary in capitals, I get an
> assertion failure that says: 'vector iterator not deferencable'. I don't
> know if removeChild() has any particular property that would mess things up,
> or if its just some subtle memory management aspect that I forgot to
> consider... I would really appreciate if someone could give me an idea of
> what's happening. Thanks.
>
>                             Renan M Z Mendes
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20080313/33413187/attachment.htm 


More information about the osg-users mailing list