Hello,

I am working on a function that incorporates the replaceChild function to
replace a node, but my program keeps faulting out in VisualStudio .NET file
free.c with the error message "Unhandled exception at 0x0040fc74 in
Interactive Architecture.exe: 0xC0000005: Access violation reading location
0xabababab."

I am new to OSG and am having problems pin-pointing my problem.

The code is as follows:
class ToolReplaceNode: public FileSelTool {            //attempt to create
.txt file by Catherine Peloquin 5-31-07
public:
   ToolReplaceNode():FileSelTool("replacenode") {}
   virtual void fileSelected(const char *n) {
       const std::string name = n;
       //osg::Node* new_node = osgDB::readNodeFile(name);
       osg::ref_ptr<SceneGraph> sceneGraph;
       sceneGraph.get();
       osg::Node *new_node = osgDB::readNodeFile(name);
       osg::Node *old_node = dynamic_cast<osg::Node
*>(editor->getSelected());
       osg::Group *parent=(old_node->asGroup())->getParent(1);
       parent->replaceChild(old_node, new_node);

   }
   virtual Tool* clone() { return new ToolReplaceNode(); }
};


I will break this into a .cxx and a .h, but just want it to run first.  I am
using Visual Studio as a compiler.

Does anyone have any suggestions?

Thanks,
Catherine Peloquin
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to