Hopefully better fix for memory leak in PartialProfiles

This commit is contained in:
heckflosse
2017-06-05 21:04:01 +02:00
parent 48bcf8b077
commit 2aaa7526b3
2 changed files with 13 additions and 2 deletions

View File

@@ -8470,20 +8470,25 @@ PartialProfile::PartialProfile(bool createInstance, bool paramsEditedValue)
pparams = nullptr;
pedited = nullptr;
}
ownsPparams = ownsPedited = true;
}
PartialProfile::PartialProfile(ProcParams* pp, ParamsEdited* pe, bool fullCopy)
{
if (fullCopy && pp) {
pparams = new ProcParams(*pp);
ownsPparams = true;
} else {
pparams = pp;
ownsPparams = false;
}
if (fullCopy && pe) {
pedited = new ParamsEdited(*pe);
ownsPedited = true;
} else {
pedited = pe;
ownsPedited = false;
}
}
@@ -8500,12 +8505,15 @@ PartialProfile::PartialProfile(const ProcParams* pp, const ParamsEdited* pe)
} else {
pedited = nullptr;
}
ownsPparams = ownsPedited = true;
}
PartialProfile::~PartialProfile()
{
delete pparams;
delete pedited;
if(ownsPparams)
delete pparams;
if(ownsPedited)
delete pedited;
}
int PartialProfile::load (const Glib::ustring &fName)