Hi David, This looks like a bug to me. I can't have thought deeply enough about the issue of removing of nested callbacks when I added the support for nesting callback, ohh quite a few years back now so I can only vaguely remember doing the work.
Any chance you can spot a bug fix for it? If so send it along to osg-submissions so I can review and merge it :-) If not I'll get round to it myself. Robert. On 28 March 2013 16:06, David Longest <david.long...@apx-labs.com> wrote: > Hello, > > > > I have encountered a crash bug when re-adding an update callback that has > nested callbacks from OSG trunk’s revision 13155. What seems to happen is > that the nested callbacks are not cleared when a callback is removed from > the middle of the nestedcallback linked list, causing a stack overflow. > > > > Example code: > > osg::NodeCallback* callback1 = new osg::NodeCallback(); > > osg::NodeCallback* callback2 = new osg::NodeCallback(); > > osg::NodeCallback* callback3 = new osg::NodeCallback(); > > osg::Node* myNode = new osg::Node(); > > > > // Callback order: 1 > > myNode->addUpdateCallback(callback1); > > > > // Callback order: 1 -> 2 > > myNode->addUpdateCallback(callback2); > > > > // Callback order: 1-> 2 -> 3 > > myNode->addUpdateCallback(callback3); > > > > // Callback order: 1 -> 3 > > // Removing the second callback will not remove the nested callback from > callback2 > > myNode->removeUpdateCallback(callback2); > > > > // Callback order: 1 -> 3 -> 2 -> 3 -> 2 ->3 ->2 ( cyclic nested callbacks) > > myNode->addUpdateCallback(callback2); > > > > Is there a reason not to clear the removed callback’s nested callbacks? If > there are reasons that the removeUpdateCallback should not remove the > callback’s nested functions, I think this behavior should be documented. > > > > Thanks, > > David > > > _______________________________________________ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org