From eef18b2a3b4ac17fd669f30f312a6d9b99b78a8f Mon Sep 17 00:00:00 2001 From: joilnen Date: Sat, 11 Jan 2025 23:15:27 -0300 Subject: [PATCH] ApplicationContextBase: changing raw pointer to smart ptr --- .../Bites/src/OgreApplicationContextBase.cpp | 4 ++-- Tests/VisualTests/Context/src/TestContext.cpp | 17 ++++++++--------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/Components/Bites/src/OgreApplicationContextBase.cpp b/Components/Bites/src/OgreApplicationContextBase.cpp index 0bcca42ee19..2fd74fbbed6 100644 --- a/Components/Bites/src/OgreApplicationContextBase.cpp +++ b/Components/Bites/src/OgreApplicationContextBase.cpp @@ -33,7 +33,7 @@ static const char* SHADER_CACHE_FILENAME = "cache.bin"; ApplicationContextBase::ApplicationContextBase(const Ogre::String& appName) { mAppName = appName; - mFSLayer = new Ogre::FileSystemLayer(mAppName); + mFSLayer.reset(new Ogre::FileSystemLayer(mAppName)); if (char* val = getenv("OGRE_CONFIG_DIR")) { @@ -53,7 +53,7 @@ ApplicationContextBase::ApplicationContextBase(const Ogre::String& appName) ApplicationContextBase::~ApplicationContextBase() { - delete mFSLayer; + } void ApplicationContextBase::initApp() diff --git a/Tests/VisualTests/Context/src/TestContext.cpp b/Tests/VisualTests/Context/src/TestContext.cpp index fcef793e775..5d1b43b0c69 100644 --- a/Tests/VisualTests/Context/src/TestContext.cpp +++ b/Tests/VisualTests/Context/src/TestContext.cpp @@ -129,7 +129,7 @@ void TestContext::setup() mWindows.push_back({mWindow}); mWindow->setDeactivateOnFocusChange(false); - + locateResources(); initialiseRTShaderSystem(); @@ -208,7 +208,7 @@ OgreBites::Sample* TestContext::loadTests() return startSample; } else - return 0; + return 0; } //----------------------------------------------------------------------- @@ -401,11 +401,11 @@ void TestContext::setupDirectories(Ogre::String batchName) if(mOutputDir.empty()) { mOutputDir = mFSLayer->getWritablePath("VisualTests/"); - static_cast(mFSLayer)->createDirectory(mOutputDir); + mFSLayer->createDirectory(mOutputDir); // make sure there's a directory for the test set mOutputDir += mTestSetName + "/"; - static_cast(mFSLayer)->createDirectory(mOutputDir); + mFSLayer->createDirectory(mOutputDir); // add a directory for the render system Ogre::String rsysName = Ogre::Root::getSingleton().getRenderSystem()->getName(); @@ -414,17 +414,16 @@ void TestContext::setupDirectories(Ogre::String batchName) if (i != ' ') mOutputDir += i; mOutputDir += "/"; - static_cast(mFSLayer)->createDirectory(mOutputDir); + mFSLayer->createDirectory(mOutputDir); } if(mSummaryOutputDir != "NONE") { - static_cast(mFSLayer)->createDirectory(mSummaryOutputDir); + mFSLayer->createDirectory(mSummaryOutputDir); } // and finally a directory for the test batch itself - static_cast(mFSLayer)->createDirectory(mOutputDir - + batchName + "/"); + mFSLayer->createDirectory(mOutputDir + batchName + "/"); } //----------------------------------------------------------------------- @@ -449,7 +448,7 @@ void TestContext::finishedTests() // if no luck, just grab the most recent compatible set foundReference = false; batches = TestBatch::loadTestBatches(mOutputDir); - + TestBatchSet::iterator i; for (i = batches.begin(); i != batches.end(); ++i) {