Fixed remove and add callback so they properly handle nested callbacks

This commit is contained in:
Robert Osfield 2013-06-10 10:37:08 +00:00
parent eb556797e2
commit 8cf9600e2c

View File

@ -58,8 +58,7 @@ class OSG_EXPORT NodeCallback : public virtual Object {
{ {
if (_nestedCallback.valid()) if (_nestedCallback.valid())
{ {
nc->addNestedCallback(_nestedCallback.get()); _nestedCallback->addNestedCallback(nc);
_nestedCallback = nc;
} }
else else
{ {
@ -74,7 +73,9 @@ class OSG_EXPORT NodeCallback : public virtual Object {
{ {
if (_nestedCallback==nc) if (_nestedCallback==nc)
{ {
_nestedCallback = _nestedCallback->getNestedCallback(); ref_ptr<NodeCallback> new_nested_callback = _nestedCallback->getNestedCallback();
_nestedCallback->setNestedCallback(0);
_nestedCallback = new_nested_callback;
} }
else if (_nestedCallback.valid()) else if (_nestedCallback.valid())
{ {