Hi, Bob inside for(...) cycle: osg::ref_ptr<osg::Group> parent(*parent_it);
As for why parents are stored by regular ptrs - in this case it is like weak ptr... parent itself hold ref_ptr of childs, so when parent removed from graph child can be freed if not referenced in other places. If childs would hold parents ref_ptr this would create cycled dependencies for referenced objects. Cheers. 15.05.2012, 18:24, "Bob Slobodan" <[email protected]>: > Hi, > > For my whole project I followed the advise in the start up guide and used > only ref_ptr (even when it's not necessary). And now I have some problem with > the getParents function of the class Node. > > I need to get the list of parents of a node and I use ref_ptr. The problem is > that the function seems to return only regular pointers and I can't get my > ref_ptr. > > Here is my code > > Code: > > parents = tmp->getParents(); > vector<osg::Group*>::iterator parent_it = parents.begin(); > vector<osg::Group*>::iterator parent_end = parents.end(); > > for( ; parent_it != parent_end ; parent_it++){ > osg::Group* parent = *parent_it; > //TODO > } > > Where tmp is a ref_ptr<osg::Group>. And instead of having parent as a > osg::Group*, I want to have a ref_ptr<osg::Group> (because I then store it > somewhere and I might need it later). > > So does anyone know what I could do ? > > Thanks, > Bob. > > ------------------ > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=47724#47724 > > _______________________________________________ > 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

