Use shared pointer to manage PImpl object

This commit is contained in:
TheAssassin
2019-01-29 00:02:49 +01:00
parent 3a0870842c
commit 8df605cb19
2 changed files with 3 additions and 6 deletions

View File

@@ -1,4 +1,5 @@
// system includes
#include <memory>
#include <string>
// library includes
@@ -19,7 +20,7 @@ namespace linuxdeploy {
private:
// private data class pattern
class PrivateData;
PrivateData* d;
std::shared_ptr<PrivateData> d;
public:
// default constructor

View File

@@ -532,15 +532,11 @@ namespace linuxdeploy {
};
AppDir::AppDir(const bf::path& path) {
d = new PrivateData();
d = std::make_shared<PrivateData>();
d->appDirPath = path;
}
AppDir::~AppDir() {
delete d;
}
AppDir::AppDir(const std::string& path) : AppDir(bf::path(path)) {}
bool AppDir::createBasicStructure() {