From ada88596dc65457a8e4b10e4c1adfc1a45be0b45 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Mon, 16 Jul 2012 15:30:09 -0700 Subject: [PATCH] Fix an abort at shutdown Ogre uses a special method to delete the stream object, so it needs to be allocated properly. --- components/esm/esm_reader.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/components/esm/esm_reader.cpp b/components/esm/esm_reader.cpp index 6b8409b45..a2cf69ddc 100644 --- a/components/esm/esm_reader.cpp +++ b/components/esm/esm_reader.cpp @@ -107,15 +107,15 @@ 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); - // Ogre will delete the stream for us + 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); - // Ogre will delete the stream for us + 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); }