OSG : segfault fix in SDCameras::~SDCameras()

git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@5234 30fe4595-0a0c-4342-8851-515496e4dcbd

Former-commit-id: b69dd341a344b4c2a841136e169565bcee6b65eb
Former-commit-id: f2ef8d91dfba863cb28c7755594ffa96bc3a9410
This commit is contained in:
rvlander 2013-03-01 12:51:14 +00:00
parent 0499f9b741
commit bc0ad79e4a
4 changed files with 10 additions and 10 deletions

View file

@ -2385,7 +2385,7 @@ void SDCameras::update(tCarElt * car, tSituation * s){
SDCameras::~SDCameras(){
for(int i=0;i<CAMERA_LISTS;i++){
for(int j=0; j<cameras[j].size();j++){
for(int j=0; j<cameras[i].size();j++){
delete cameras[i][j];
}
}

View file

@ -118,14 +118,14 @@ void OsgGraph::unloadCars()
void OsgGraph::unloadTrack()
{
GfLogDebug("OsgGraph::unloadTrack\n");
::shutdownTrack();
//GfLogDebug("SsgGraph::unloadTrack\n");
::shutdownTrack();
}
void OsgGraph::shutdownView()
{
GfLogDebug("OsgGraph::shutdownView\n");
::shutdownView();
//GfLogDebug("SsgGraph::shutdownView\n");
::shutdownView();
}
Camera* OsgGraph::getCurCam()

View file

@ -394,7 +394,7 @@ int initCars(tSituation *s)
void
shutdownTrack(void)
{
m_sceneroot->removeChildren(0,m_sceneroot->getNumChildren());
//m_sceneroot->removeChildren(0,m_sceneroot->getNumChildren());
// Do the real track termination job.
delete scenery;
//delete m_sceneroot;

View file

@ -42,9 +42,9 @@ void SDScreens::Init(int x,int y, int width, int height, osg::ref_ptr<osg::Group
//intialising main screen
osg::Camera * mirrorCam = new osg::Camera;
osg::ref_ptr<osg::Camera> mirrorCam = new osg::Camera;
SDView * view = new SDView(viewer->getCamera(),0,0,grWinw,grWinh,mirrorCam);
SDView * view = new SDView(viewer->getCamera(),0,0,grWinw,grWinh,mirrorCam.get());
viewer->setThreadingModel(osgViewer::Viewer::CullThreadPerCameraDrawThreadPerContext);
osg::ref_ptr<osgViewer::GraphicsWindowEmbedded> gw = viewer->setUpViewerAsEmbeddedInWindow(0, 0, grWinw, grWinh);
@ -66,7 +66,7 @@ void SDScreens::Init(int x,int y, int width, int height, osg::ref_ptr<osg::Group
//adding all otherer cams
osg::Camera * screenCam;
osg::ref_ptr<osg::Camera> screenCam;
for(int i=1;i<GR_NB_MAX_SCREEN;i++){
screenCam = new osg::Camera;
screenCam->setGraphicsContext(gw);
@ -83,7 +83,7 @@ void SDScreens::Init(int x,int y, int width, int height, osg::ref_ptr<osg::Group
mirrorCam->addChild(m_sceneroot);
mirrorCam->setNodeMask(0);
view = new SDView(screenCam,0,0,grWinw,grWinh,mirrorCam);
view = new SDView(screenCam.get(),0,0,grWinw,grWinh,mirrorCam.get());
grScreens.insert(grScreens.end(),view);