From 49a0398fc67e95702c304421e6f868b70ad76ca2 Mon Sep 17 00:00:00 2001 From: James Turner Date: Sat, 18 Jan 2014 18:49:03 +0000 Subject: [PATCH] Make lifetime of CameraViewportListener explicit. MSVC is warning on this usage, as is the Mac release build. Working around the issue for the moment. --- src/Viewer/CameraGroup.cxx | 8 ++++---- src/Viewer/CameraGroup.hxx | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Viewer/CameraGroup.cxx b/src/Viewer/CameraGroup.cxx index 7eba76c5f..1600ee564 100644 --- a/src/Viewer/CameraGroup.cxx +++ b/src/Viewer/CameraGroup.cxx @@ -361,7 +361,7 @@ void CameraInfo::resized(double w, double h) CameraInfo::~CameraInfo() { - + delete viewportListener; } osg::Camera* CameraInfo::getCamera(const std::string& k) const @@ -1035,7 +1035,7 @@ CameraInfo* CameraGroup::buildCamera(SGPropertyNode* cameraNode) // out of the SceneView objects in the viewer, and the coordinates // of mouse events are somewhat bizzare. - info->viewportListener.reset(new CameraViewportListener(info, viewportNode, window->gc->getTraits())); + info->viewportListener = new CameraViewportListener(info, viewportNode, window->gc->getTraits()); info->updateCameras(); // Distortion camera needs the viewport which is created by addCamera(). @@ -1097,8 +1097,8 @@ CameraInfo* CameraGroup::buildGUICamera(SGPropertyNode* cameraNode, camera->setRenderOrder(osg::Camera::POST_RENDER, 10000); SGPropertyNode* viewportNode = cameraNode->getNode("viewport", true); - result->viewportListener.reset(new CameraViewportListener(result, viewportNode, - window->gc->getTraits())); + result->viewportListener = new CameraViewportListener(result, viewportNode, + window->gc->getTraits()); // Disable statistics for the GUI camera. camera->setStats(0); diff --git a/src/Viewer/CameraGroup.hxx b/src/Viewer/CameraGroup.hxx index 84447e43c..4b53359b1 100644 --- a/src/Viewer/CameraGroup.hxx +++ b/src/Viewer/CameraGroup.hxx @@ -101,7 +101,8 @@ struct CameraInfo : public osg::Referenced worldPosCart( new osg::Uniform( "fg_CameraPositionCart", osg::Vec3f() ) ), worldPosGeod( new osg::Uniform( "fg_CameraPositionGeod", osg::Vec3f() ) ), du( new osg::Uniform( "fg_du",osg::Vec4() ) ), - dv( new osg::Uniform( "fg_dv",osg::Vec4() ) ) + dv( new osg::Uniform( "fg_dv",osg::Vec4() ) ), + viewportListener(NULL) { shadowMatrix[0] = new osg::Uniform("fg_ShadowMatrix_0", osg::Matrixf()); shadowMatrix[1] = new osg::Uniform("fg_ShadowMatrix_1", osg::Matrixf()); @@ -167,7 +168,7 @@ struct CameraInfo : public osg::Referenced osg::ref_ptr dv; osg::ref_ptr shadowMatrix[4]; - std::auto_ptr viewportListener; + CameraViewportListener* viewportListener; void setMatrices( osg::Camera* c );