From 8cf9600e2c7ce20fda02be9edc30758cff295385 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 10 Jun 2013 10:37:08 +0000 Subject: [PATCH] Fixed remove and add callback so they properly handle nested callbacks --- include/osg/NodeCallback | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/include/osg/NodeCallback b/include/osg/NodeCallback index ae3254eb9..4676746ae 100644 --- a/include/osg/NodeCallback +++ b/include/osg/NodeCallback @@ -58,8 +58,7 @@ class OSG_EXPORT NodeCallback : public virtual Object { { if (_nestedCallback.valid()) { - nc->addNestedCallback(_nestedCallback.get()); - _nestedCallback = nc; + _nestedCallback->addNestedCallback(nc); } else { @@ -74,7 +73,9 @@ class OSG_EXPORT NodeCallback : public virtual Object { { if (_nestedCallback==nc) { - _nestedCallback = _nestedCallback->getNestedCallback(); + ref_ptr new_nested_callback = _nestedCallback->getNestedCallback(); + _nestedCallback->setNestedCallback(0); + _nestedCallback = new_nested_callback; } else if (_nestedCallback.valid()) {