Hi Roland,

My guess is that that clean up of the globals is being done in order that
results in issues with destruction order as your program is no longer
explicitly defining the order. You have to be very careful about using
globals in applications for this reason.

If you reset the global ref_ptr<>'s back to zero before exiting main will
likely fix the issue with using these globals, but personally I'd suggest
avoiding the globals.

Robert.


On 3 May 2013 01:55, Roland Hill <[email protected]>wrote:

> Hi,
>
> I have been writing a simple test program to try to solve another issue
> and found that when I use global referenced pointers OSG (trunk) seg faults
> on exit.
>
> This works without any issue:
>
>
> Code:
>
> #include < osgViewer/Viewer >
> #include < osg/Node >
>
> int main(int argc, char** argv)
> {
> osg::ref_ptr< osgViewer::Viewer > viewer = new osgViewer::Viewer();
>
> osg::ref_ptr< osg::Node > globe = new osg::Node;
> viewer->setSceneData( globe );
>
> return viewer->run();
> }
>
>
>
>
> This seg faults on exit:
>
>
> Code:
>
> #include < osgViewer/Viewer >
> #include < osg/Node >
>
> osg::ref_ptr< osgViewer::Viewer > viewer;
> osg::ref_ptr< osg::Node > globe;
>
> int main(int argc, char** argv)
> {
> viewer = new osgViewer::Viewer();
>
> globe = new osg::Node;
> viewer->setSceneData( globe );
>
> return viewer->run();
> }
>
>
>
>
> The only difference is the global scope reference pointers (it is the same
> if you load cow.osg instead of an empty node). I would have thought this
> should work - am I missing something simple?
>
> Using OSG 3.1.6 (updated today 3 May), Kubuntu 12.04 64 bit.
>
> Thank you!
>
> Cheers,
> Roland
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=53899#53899
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to