1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-19 23:23:52 +00:00

Fix an abort at shutdown

Ogre uses a special method to delete the stream object, so it needs to be
allocated properly.
This commit is contained in:
Chris Robinson 2012-07-16 15:30:09 -07:00
parent fb1f8082d2
commit ada88596dc

View file

@ -107,14 +107,14 @@ void ESMReader::open(Ogre::DataStreamPtr _esm, const std::string &name)
void ESMReader::open(const std::string &file)
{
std::ifstream *stream = new std::ifstream(file.c_str(), std::ios_base::binary);
std::ifstream *stream = OGRE_NEW_T(std::ifstream, Ogre::MEMCATEGORY_GENERAL)(file.c_str(), std::ios_base::binary);
// Ogre will delete the stream for us
open(Ogre::DataStreamPtr(new Ogre::FileStreamDataStream(stream)), file);
}
void ESMReader::openRaw(const std::string &file)
{
std::ifstream *stream = new std::ifstream(file.c_str(), std::ios_base::binary);
std::ifstream *stream = OGRE_NEW_T(std::ifstream, Ogre::MEMCATEGORY_GENERAL)(file.c_str(), std::ios_base::binary);
// Ogre will delete the stream for us
openRaw(Ogre::DataStreamPtr(new Ogre::FileStreamDataStream(stream)), file);
}