Skip to content

ApplicationContextBase: changing raw pointer to smart ptr #3269

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Components/Bites/include/OgreApplicationContextBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ namespace OgreBites

Ogre::OverlaySystem* mOverlaySystem; // Overlay system

Ogre::FileSystemLayer* mFSLayer; // File system abstraction layer
std::unique_ptr<Ogre::FileSystemLayer> mFSLayer; // File system abstraction layer
Ogre::Root* mRoot; // OGRE root
StaticPluginLoader mStaticPluginLoader;
bool mFirstRun;
Expand Down
4 changes: 2 additions & 2 deletions Components/Bites/src/OgreApplicationContextBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
{
Expand All @@ -53,7 +53,7 @@ ApplicationContextBase::ApplicationContextBase(const Ogre::String& appName)

ApplicationContextBase::~ApplicationContextBase()
{
delete mFSLayer;

}

void ApplicationContextBase::initApp()
Expand Down
17 changes: 8 additions & 9 deletions Tests/VisualTests/Context/src/TestContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ void TestContext::setup()
mWindows.push_back({mWindow});

mWindow->setDeactivateOnFocusChange(false);

locateResources();
initialiseRTShaderSystem();

Expand Down Expand Up @@ -208,7 +208,7 @@ OgreBites::Sample* TestContext::loadTests()
return startSample;
}
else
return 0;
return 0;
}
//-----------------------------------------------------------------------

Expand Down Expand Up @@ -401,11 +401,11 @@ void TestContext::setupDirectories(Ogre::String batchName)
if(mOutputDir.empty())
{
mOutputDir = mFSLayer->getWritablePath("VisualTests/");
static_cast<Ogre::FileSystemLayer*>(mFSLayer)->createDirectory(mOutputDir);
mFSLayer->createDirectory(mOutputDir);

// make sure there's a directory for the test set
mOutputDir += mTestSetName + "/";
static_cast<Ogre::FileSystemLayer*>(mFSLayer)->createDirectory(mOutputDir);
mFSLayer->createDirectory(mOutputDir);

// add a directory for the render system
Ogre::String rsysName = Ogre::Root::getSingleton().getRenderSystem()->getName();
Expand All @@ -414,17 +414,16 @@ void TestContext::setupDirectories(Ogre::String batchName)
if (i != ' ')
mOutputDir += i;
mOutputDir += "/";
static_cast<Ogre::FileSystemLayer*>(mFSLayer)->createDirectory(mOutputDir);
mFSLayer->createDirectory(mOutputDir);
}

if(mSummaryOutputDir != "NONE")
{
static_cast<Ogre::FileSystemLayer*>(mFSLayer)->createDirectory(mSummaryOutputDir);
mFSLayer->createDirectory(mSummaryOutputDir);
}

// and finally a directory for the test batch itself
static_cast<Ogre::FileSystemLayer*>(mFSLayer)->createDirectory(mOutputDir
+ batchName + "/");
mFSLayer->createDirectory(mOutputDir + batchName + "/");
}
//-----------------------------------------------------------------------

Expand All @@ -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)
{
Expand Down