From 782d3d9680eeb325d0f4b40b95601d92e37fcdbe Mon Sep 17 00:00:00 2001 From: elsid Date: Tue, 17 May 2022 13:08:31 +0200 Subject: [PATCH] Avoid calling getMultiview from ~StereoFrustumManager Otherwise coverity complains about a function throwing exceptions called from a destructor. --- components/stereo/frustum.cpp | 5 +++-- components/stereo/frustum.hpp | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/components/stereo/frustum.cpp b/components/stereo/frustum.cpp index 81fd022f58..31104d66f3 100644 --- a/components/stereo/frustum.cpp +++ b/components/stereo/frustum.cpp @@ -96,8 +96,9 @@ namespace Stereo : mCamera(camera) , mShadowTechnique(nullptr) , mShadowFrustumCallback(nullptr) + , mMultiview(Stereo::getMultiview()) { - if (Stereo::getMultiview()) + if (mMultiview) { #ifdef OSG_HAS_MULTIVIEW mMultiviewFrustumCallback = new MultiviewFrustumCallback(this); @@ -118,7 +119,7 @@ namespace Stereo StereoFrustumManager::~StereoFrustumManager() { - if (Stereo::getMultiview()) + if (mMultiview) { #ifdef OSG_HAS_MULTIVIEW mCamera->setInitialFrustumCallback(nullptr); diff --git a/components/stereo/frustum.hpp b/components/stereo/frustum.hpp index 579d3b6876..8d457c82b9 100644 --- a/components/stereo/frustum.hpp +++ b/components/stereo/frustum.hpp @@ -64,6 +64,7 @@ namespace Stereo osg::ref_ptr mCamera; osg::ref_ptr mShadowTechnique; osg::ref_ptr mShadowFrustumCallback; + bool mMultiview; std::map< osgUtil::CullVisitor*, osgUtil::CullVisitor*> mSharedFrustums; osg::BoundingBoxd mBoundingBox;