From 973ac7619753defc85369e2adec9752ffc6d6219 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 8 Aug 2014 15:45:54 +0000 Subject: [PATCH] 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 --- include/osg/Node | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/include/osg/Node b/include/osg/Node index ec7ef4878..08c6cd254 100644 --- a/include/osg/Node +++ b/include/osg/Node @@ -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 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 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 new_nested_callback = nc->getNestedCallback(); nc->setNestedCallback(0); + setCullCallback(new_nested_callback.get()); // replace the callback by the nested one } else _cullCallback->removeNestedCallback(nc); }