From Glen Waldron, "Node: patch for remove*Callback() methods to resolve a crash"

git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14401 16af8721-9629-0410-8352-f15c8da7e697
This commit is contained in:
Robert Osfield 2014-08-08 15:45:54 +00:00
parent 99cbab1806
commit 973ac76197

View File

@ -223,8 +223,9 @@ class OSG_EXPORT Node : public Object
if (nc != NULL && _updateCallback.valid()) {
if (_updateCallback == nc)
{
setUpdateCallback(nc->getNestedCallback()); // replace the callback by the nested one
ref_ptr<osg::Callback> new_nested_callback = nc->getNestedCallback();
nc->setNestedCallback(0);
setUpdateCallback(new_nested_callback.get());
}
else _updateCallback->removeNestedCallback(nc);
}
@ -257,8 +258,9 @@ class OSG_EXPORT Node : public Object
if (nc != NULL && _eventCallback.valid()) {
if (_eventCallback == nc)
{
setEventCallback(nc->getNestedCallback()); // replace the callback by the nested one
ref_ptr<osg::Callback> new_nested_callback = nc->getNestedCallback();
nc->setNestedCallback(0);
setEventCallback(new_nested_callback.get()); // replace the callback by the nested one
}
else _eventCallback->removeNestedCallback(nc);
}
@ -291,8 +293,9 @@ class OSG_EXPORT Node : public Object
if (nc != NULL && _cullCallback.valid()) {
if (_cullCallback == nc)
{
setCullCallback(nc->getNestedCallback()); // replace the callback by the nested one
ref_ptr<osg::Callback> new_nested_callback = nc->getNestedCallback();
nc->setNestedCallback(0);
setCullCallback(new_nested_callback.get()); // replace the callback by the nested one
}
else _cullCallback->removeNestedCallback(nc);
}