Hi Robert,

With latest SVN. See the attached testcase (reduced from the raytracing example posted earlier).

With the default threading model I get crashes on exit for e.g. dumptruck, cow and cessnafire:

[cessnafire.osg]
#0 0x004a10b5 in osg::Group::releaseGLObjects (this=0x8c82038, state=0x8ce8a80) at /home/paul/c/osg-svn/src/osg/Group.cpp:414
414             (*itr)->releaseGLObjects(state);
(gdb) bt
#0 0x004a10b5 in osg::Group::releaseGLObjects (this=0x8c82038, state=0x8ce8a80) at /home/paul/c/osg-svn/src/osg/Group.cpp:414 #1 0x004a10b8 in osg::Group::releaseGLObjects (this=0x8c363a8, state=0x8ce8a80) at /home/paul/c/osg-svn/src/osg/Group.cpp:414 #2 0x004a10b8 in osg::Group::releaseGLObjects (this=0x8c361d8, state=0x8ce8a80) at /home/paul/c/osg-svn/src/osg/Group.cpp:414 #3 0x004a10b8 in osg::Group::releaseGLObjects (this=0x8c1f548, state=0x8ce8a80) at /home/paul/c/osg-svn/src/osg/Group.cpp:414 #4 0x004a10b8 in osg::Group::releaseGLObjects (this=0x8c19ce0, state=0x8ce8a80) at /home/paul/c/osg-svn/src/osg/Group.cpp:414 #5 0x00402b68 in osg::Camera::releaseGLObjects (this=0x8c19ce0, state=0x8ce8a80) at /home/paul/c/osg-svn/src/osg/Camera.cpp:304 #6 0x00499a2e in osg::GraphicsContext::close (this=0x8c89bd8, callCloseImplementation=true)
   at /home/paul/c/osg-svn/src/osg/GraphicsContext.cpp:460
#7 0x00aeca0a in ~Viewer (this=0x804b280) at /home/paul/c/osg-svn/src/osgViewer/Viewer.cpp:209
#8  0x080497cd in __tcf_1 ()
#9  0x005fe949 in exit () from /lib/libc.so.6
#10 0x005e8d87 in __libc_start_main () from /lib/libc.so.6
#11 0x080493f1 in _start ()

[dumptruck.osg]
#0 osgDB::DatabasePager::compileGLObjects (this=0x86418a8, [EMAIL PROTECTED], [EMAIL PROTECTED])
   at /home/paul/c/osg-svn/include/osg/ref_ptr:71
71              T* get() const { return _ptr; }
(gdb) bt
#0 osgDB::DatabasePager::compileGLObjects (this=0x86418a8, [EMAIL PROTECTED], [EMAIL PROTECTED])
   at /home/paul/c/osg-svn/include/osg/ref_ptr:71
#1 0x00147eb6 in osgViewer::Renderer::flushAndCompile (this=0x8641ec0, currentElapsedFrameTime=0.002323, sceneView=0x8642608, databasePager=0x86418a8, compileThread=0x0) at /home/paul/c/osg-svn/src/osgViewer/Renderer.cpp:614 #2 0x0014cdb5 in osgViewer::Renderer::draw (this=0x8641ec0) at /home/paul/c/osg-svn/src/osgViewer/Renderer.cpp:423 #3 0x00147bc9 in osgViewer::Renderer::operator() (this=0x93bea8, context=0x865d0d8) at /home/paul/c/osg-svn/src/osgViewer/Renderer.cpp:635 #4 0x003c9d4e in osg::GraphicsContext::runOperations (this=0x865d0d8) at /home/paul/c/osg-svn/src/osg/GraphicsContext.cpp:688 #5 0x003cd56f in osg::RunOperations::operator() (this=0x8733650, context=0x865d0d8) at /home/paul/c/osg-svn/src/osg/GraphicsThread.cpp:134 #6 0x003cd40e in osg::GraphicsOperation::operator() (this=0x8733650, object=0x865d0d8)
   at /home/paul/c/osg-svn/src/osg/GraphicsThread.cpp:50
#7 0x004028fa in osg::OperationThread::run (this=0x87333e0) at /home/paul/c/osg-svn/src/osg/OperationThread.cpp:413 #8 0x003cd63e in osg::GraphicsThread::run (this=0x87333e0) at /home/paul/c/osg-svn/src/osg/GraphicsThread.cpp:38 #9 0x00277b0f in OpenThreads::ThreadPrivateActions::StartThread (data=0x87333f0)
   at /home/paul/c/osg-svn/src/OpenThreads/pthreads/PThread.c++:170
#10 0x009b3bd4 in start_thread () from /lib/libpthread.so.0
#11 0x008354fe in clone () from /lib/libc.so.6

With OSG_THREADING set to SingleThreaded it crashes on exit when viewing cessnafire.osg (and other models containing particle systems). I don't get such crashes on e.g. dumptruck and the cow anymore.

[cessnafire.osg, same as above]
#0 0x002650b5 in osg::Group::releaseGLObjects (this=0x9fdb040, state=0xa041a88) at /home/paul/c/osg-svn/src/osg/Group.cpp:414
414             (*itr)->releaseGLObjects(state);
(gdb) bt
#0 0x002650b5 in osg::Group::releaseGLObjects (this=0x9fdb040, state=0xa041a88) at /home/paul/c/osg-svn/src/osg/Group.cpp:414 #1 0x002650b8 in osg::Group::releaseGLObjects (this=0x9f8f3b0, state=0xa041a88) at /home/paul/c/osg-svn/src/osg/Group.cpp:414 #2 0x002650b8 in osg::Group::releaseGLObjects (this=0x9f8f1e0, state=0xa041a88) at /home/paul/c/osg-svn/src/osg/Group.cpp:414 #3 0x002650b8 in osg::Group::releaseGLObjects (this=0x9f78550, state=0xa041a88) at /home/paul/c/osg-svn/src/osg/Group.cpp:414 #4 0x002650b8 in osg::Group::releaseGLObjects (this=0x9f72ce8, state=0xa041a88) at /home/paul/c/osg-svn/src/osg/Group.cpp:414 #5 0x001c6b68 in osg::Camera::releaseGLObjects (this=0x9f72ce8, state=0xa041a88) at /home/paul/c/osg-svn/src/osg/Camera.cpp:304 #6 0x0025da2e in osg::GraphicsContext::close (this=0x9fe2be0, callCloseImplementation=true)
   at /home/paul/c/osg-svn/src/osg/GraphicsContext.cpp:460
#7 0x00f1da0a in ~Viewer (this=0x804b280) at /home/paul/c/osg-svn/src/osgViewer/Viewer.cpp:209
#8  0x080497cd in __tcf_1 ()
#9  0x00795949 in exit () from /lib/libc.so.6
#10 0x0077fd87 in __libc_start_main () from /lib/libc.so.6
#11 0x080493f1 in _start ()


Paul
#include <cstdio>

#include <osgDB/ReadFile>
#include <osgDB/WriteFile>

#include <osg/ArgumentParser>
#include <osg/ApplicationUsage>
#include <osg/Group>
#include <osg/Image>
#include <osg/Geode>
#include <osg/Camera>
#include <osg/Geometry>
#include <osg/Texture2D>
#include <osg/Projection>
#include <osg/MatrixTransform>

#include <osgGA/TrackballManipulator>
#include <osgViewer/Viewer>

osg::ref_ptr<osg::Switch>       root;
osgViewer::Viewer               viewer;
osg::ref_ptr<osg::Node>         scene;
osg::ref_ptr<osg::Camera>       camera;

int
main(int argc, char **argv)
{
    // use an ArgumentParser object to manage the program arguments.
    osg::ArgumentParser arguments(&argc,argv);

    osgDB::Registry::instance()->setBuildKdTreesHint(osgDB::ReaderWriter::Options::BUILD_KDTREES);

    root = new osg::Switch();

    scene = osgDB::readNodeFiles(arguments);

    if (!scene)
    {
        printf("No model loaded, please specify a valid model on the command line.\n");
        return 0;
    }

    root->addChild(scene.get());

    osg::GraphicsContext::Traits    *traits = new osg::GraphicsContext::Traits();
    traits->x = 100;
    traits->y = 100;
    traits->width = 512;
    traits->height = 512;
    traits->windowDecoration = true;
    traits->doubleBuffer = true;
    traits->sharedContext = 0;

    osg::GraphicsContext    *gc = osg::GraphicsContext::createGraphicsContext(traits);

    camera = viewer.getCamera();
    camera->setGraphicsContext(gc);
    camera->setViewport(0, 0, traits->width, traits->height);
    camera->setProjectionMatrixAsPerspective(45.0, 1.0*traits->width/traits->height, 0.1, 1000.0);

    viewer.setSceneData(root.get());

    viewer.realize();
    viewer.run();
}

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to