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

Reply via email to