use shared_ptr to avoid possible memory leaks and improve exception-safety

This commit is contained in:
wmayer
2019-09-03 17:15:24 +02:00
parent c4b0073022
commit 10cd535ceb
3 changed files with 11 additions and 14 deletions

View File

@@ -27,6 +27,7 @@
#include <string>
#include <map>
#include <bitset>
#include <memory>
#include <xercesc/framework/XMLPScanToken.hpp>
#include <xercesc/sax2/Attributes.hpp>
@@ -299,14 +300,14 @@ public:
std::istream& getStream();
std::string getFileName() const;
int getFileVersion() const;
void initLocalReader(Base::XMLReader *ptr);
Base::XMLReader *getLocalReader();
void initLocalReader(std::shared_ptr<Base::XMLReader>);
std::shared_ptr<Base::XMLReader> getLocalReader() const;
private:
std::istream& _str;
std::string _name;
int fileVersion;
Base::XMLReader *localreader=nullptr;
std::shared_ptr<Base::XMLReader> localreader;
};
}