Hi all, I can confirm that this issue exists in 2.9.6 as well and believe Colin's assessment is correct. Changing the raw pointer to the RequestQueue in the DatabaseRequest to an observer_ptr and taking a temporary ref when using it fixes the issue. I'm including a full program that you can use to test the issue (based on Brett's program but using ref_ptr instead of raw pointers for the Viewer ;) )
I'll post a fix to osg-submissions shortly. Thanks! Jason #include <osgDB/ReadFile> #include <osgViewer/Viewer> #include <osgGA/TrackballManipulator> int main(int argc, char** argv) { std::string modelPath = " http://www.openscenegraph.org/data/earth_bayarea/earth.ive"; // create a scene graph (and keep it around). osg::ref_ptr<osg::Node> modelNode = osgDB::readNodeFile(modelPath); // create a viewer and set the scene graph data. osg::ref_ptr<osgViewer::Viewer> viewer = new osgViewer::Viewer(); viewer->setSceneData(modelNode.get()); viewer->setCameraManipulator(new osgGA::TrackballManipulator()); //Render the viewer until it's finished viewer->realize(); while(!viewer->done()) { viewer->frame(); } // Create a new viewer and set the scene graph data to the same data. viewer = new osgViewer::Viewer(); viewer->setCameraManipulator(new osgGA::TrackballManipulator()); viewer->setSceneData(modelNode.get()); //Render until finished viewer->realize(); while(!viewer->done()) { viewer->frame(); } return 0; } On Wed, Jan 20, 2010 at 3:40 PM, Robert Osfield <robert.osfi...@gmail.com>wrote: > Hi Brett, > > You really should learn to use ref_ptr<>'s, manually deleting ref > counting objects is dangerous and only possible Viewer as I haven't > put the destructor private to allow one to construct the Viewer on the > stack for convenience, not to allow delete... > > That sermon aside, could you please try your example with svn/trunk or > 2.9.6. > > Thanks, > Robert. > > > > On Wed, Jan 20, 2010 at 8:25 PM, Brett Wiesner <brettwies...@gmail.com> > wrote: > > Robert, > > > > Here is a sample program that crashes when loading earth.ive the second > > time. I'm using OSG 2.8.2. > > > > Thanks, > > Brett > > > > main() > > { > > > > std::string modelPath = "earth.ive"; > > > > // create a scene graph (and keep it around). > > osg::ref_ptr<osg::Node> modelNode = osgDB::readNodeFile(modelPath); > > > > // create viewer1 and set the scene graph data. > > osgViewer::Viewer* viewer1 = new osgViewer::Viewer; > > viewer1->setUpViewOnSingleScreen(0); > > viewer1->setSceneData(modelNode.get()); > > viewer1->setCameraManipulator(new osgGA::TrackballManipulator()); > > > > // render a frame > > viewer1->realize(); > > while(!viewer1->done()) > > { > > viewer1->frame(); > > } > > > > // delete viewer1. > > delete viewer1; > > viewer1 = 0; > > > > // create viewer2 and set the scene graph data. > > > > osgViewer::Viewer* viewer2 = new osgViewer::Viewer; > > viewer2->setUpViewOnSingleScreen(0); > > viewer2->setSceneData(modelNode.get()); > > viewer2->setCameraManipulator(new osgGA::TrackballManipulator()); > > > > // render a frame > > viewer2->realize(); > > > > while(!viewer2->done()) > > { > > viewer2->frame(); > > } > > > > // check that it has textures. > > > > // delete viewer2. > > delete viewer2; > > viewer2 = 0; > > > > } > > > > Robert Osfield wrote: > >> > >> Hi Colin, > >> > >> You make no mention of which version of the OSG you are using. The > >> DatabasePager and manage of GL objects when destroying contexts has > >> improved significantly over the past year so the problems you are > >> seeing may well be already resolved. > >> > >> Robert. > >> > >> On Thu, Jan 14, 2010 at 5:00 PM, Colin Branch <cbra...@mak.com> wrote: > >> > >>> > >>> Greetings, > >>> > >>> Here's my steps: > >>> I'm creating a compositeViewer with one or more views. > >>> I'm loading a paged database. > >>> While the database is paging, I delete the compositeViewer (thus taking > >>> the > >>> context down with it as well as the database pager). > >>> I then create a new compositeViewer and attempt to render the sane > >>> database > >>> (same nodes). > >>> I'm getting a crash in the database pager, specifically it crash in the > >>> requestNodeFile function due to crashing on accessing invalid memory. > >>> > >>> The problem seems to step from the PagedLOD having a ref_ptr to a > >>> DatabasePager::DatabaseRequest. > >>> The databaseRequest has a raw pointer to a RequestQueue. > >>> The RequestQueue is invalid (as it is a referenced member of the > original > >>> database pager, and thus is already deleted, but the DB request stayed > >>> alive). > >>> There appears to be no way of clearing the databaseRequest which is > >>> referenced in the PagedLOD node. > >>> > >>> This appears to be a problem with how OSG handles database paging, > >>> probably > >>> a bug. No obvious solution pops out, mainly due to the low level nature > >>> of > >>> the problem. > >>> This is an important issue since it affects one of our customers. > >>> I welcome any comments/suggestions/workarounds. > >>> > >>> Thank you and best regards, > >>> Colin Branch > >>> > >>> -- > >>> Colin Branch > >>> VT MAK > >>> work: (617) 876-8085 Ext. 159 > >>> email: cbra...@mak.com > >>> > >>> _______________________________________________ > >>> osg-users mailing list > >>> osg-users@lists.openscenegraph.org > >>> > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > >>> > >>> > >> > >> _______________________________________________ > >> osg-users mailing list > >> osg-users@lists.openscenegraph.org > >> > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > >> > > > > _______________________________________________ > > osg-users mailing list > > osg-users@lists.openscenegraph.org > > > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > > _______________________________________________ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org >
_______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org