I think you need to set your  (*ponto_itr) to NULL or remove it from the
vector after you have done the remove child, other wise the pointer still
has the address of the child you previously removed so you for loop above
(ponto_limp) will never do any thing
 
 
 

__________________________________________________________
Gordon Tomlinson 

Email   : [EMAIL PROTECTED]
Website : www.vis-sim.com www.gordontomlinson.com 


__________________________________________________________

"Self defence is not a function of learning tricks 
but is a function of how quickly and intensely one 
can arouse one's instinct for survival" 
-Master Tambo Tetsura 

 

  _____  

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Renan
Mendes
Sent: 03 January 2008 14:43
To: OpenSceneGraph Users
Subject: [Norton AntiSpam] Re: [osg-users] Error: 'Debug Assertion Failure!'


Hi, Rafa,

        I've tried doing something like what you've said before: every time
before I checked for selections with verifySelection(), I searched for a
NULL member and erased it, like it's done below. Can you tell me why it
still isn't working? Is there a logical flaw in my code? 

       Thanks,
           Renan M Z Mendes

        case(osgGA::GUIEventAdapter::KEYDOWN):
            {
                if(!ponto.empty())
                {
                    for(ponto_limp = ponto.begin(); ponto_limp !=
ponto.end(); ponto_limp++)
                    {
                        if(*ponto_limp == NULL)
                        {
                            ponto.erase(ponto_limp);
                        } 
                    }

                    for(ponto_itr = ponto.begin(); ponto_itr != ponto.end();
ponto_itr++)
                    {
                        if((*ponto_itr)->verifySelection())
                        { 
                            switch(ea.getKey())
                            {
                            case(ea.KEY_Delete):
                                {
                                    osg::Group* root =
(*ponto_itr)->getParent(0); 
 
root->removeChild(root->getChildIndex((*ponto_itr)), 1);
                                }
                            }
                        }
                    } 
                }
           }

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to