From 7dd9ea7a307e4cf4bfb480ba15eda63e553a5f45 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Sat, 30 Jun 2007 14:28:24 +0000 Subject: [PATCH] Added debug path that creates the viewer on the heap. --- examples/osgteapot/osgteapot.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/examples/osgteapot/osgteapot.cpp b/examples/osgteapot/osgteapot.cpp index 333e91f84..8cf358ecc 100644 --- a/examples/osgteapot/osgteapot.cpp +++ b/examples/osgteapot/osgteapot.cpp @@ -332,6 +332,23 @@ osg::Geode* createTeapot() int main(int , char **) { +#if 1 + + // create viewer on heap as a test, this looks to be causing problems + // on init on some platforms, and seg fault on exit when multi-threading on linux. + // Normal stack based version below works fine though... + + // construct the viewer. + osg::ref_ptr viewer = new osgViewer::Viewer; + + // add model to viewer. + viewer->setSceneData( createTeapot() ); + + // create the windows and run the threads. + return viewer->run(); + +#else + // construct the viewer. osgViewer::Viewer viewer; @@ -340,4 +357,7 @@ int main(int , char **) // create the windows and run the threads. return viewer.run(); + +#endif + }