Make PartialProfile non-copyable

This commit is contained in:
Flössie
2017-11-21 18:11:26 +01:00
parent 0fc6d2f98e
commit 0eb3969279
3 changed files with 26 additions and 24 deletions

View File

@@ -4427,6 +4427,16 @@ void PartialProfile::applyTo(ProcParams* destParams) const
}
}
AutoPartialProfile::AutoPartialProfile() :
PartialProfile(true)
{
}
AutoPartialProfile::~AutoPartialProfile()
{
deleteInstance();
}
}
}

View File

@@ -28,6 +28,7 @@
#include "coord.h"
#include "LUT.h"
#include "noncopyable.h"
class ParamsEdited;
@@ -1307,7 +1308,6 @@ private:
* @return Error code (=0 if no error)
* */
int write(const Glib::ustring& fname, const Glib::ustring& content) const;
};
/**
@@ -1319,18 +1319,10 @@ private:
* and hence is not responsible of their destructions. The function that instanciate
* PartialProfile object has to handle all this itself.
*/
class PartialProfile
class PartialProfile :
public NonCopyable
{
public:
rtengine::procparams::ProcParams* pparams;
ParamsEdited* pedited;
PartialProfile& operator =(const PartialProfile& rhs)
{
pparams = rhs.pparams;
pedited = rhs.pedited;
return *this;
};
PartialProfile(bool createInstance = false, bool paramsEditedValue = false);
PartialProfile(ProcParams* pp, ParamsEdited* pe = nullptr, bool fullCopy = false);
PartialProfile(const ProcParams* pp, const ParamsEdited* pe = nullptr);
@@ -1339,6 +1331,9 @@ public:
int load(const Glib::ustring& fName);
void set(bool v);
void applyTo(ProcParams* destParams) const ;
rtengine::procparams::ProcParams* pparams;
ParamsEdited* pedited;
};
/**
@@ -1350,11 +1345,8 @@ class AutoPartialProfile :
public PartialProfile
{
public:
AutoPartialProfile() : PartialProfile (true) {}
~AutoPartialProfile()
{
deleteInstance();
}
AutoPartialProfile();
~AutoPartialProfile();
};
}

View File

@@ -1021,7 +1021,7 @@ void FileBrowser::pasteProfile ()
for (unsigned int i = 0; i < mselected.size(); i++) {
// copying read only clipboard PartialProfile to a temporary one
rtengine::procparams::PartialProfile cbPartProf = clipboard.getPartialProfile();
const rtengine::procparams::PartialProfile& cbPartProf = clipboard.getPartialProfile();
rtengine::procparams::PartialProfile pastedPartProf(cbPartProf.pparams, cbPartProf.pedited, true);
// applying the PartialProfile to the thumb's ProcParams
@@ -1069,7 +1069,7 @@ void FileBrowser::partPasteProfile ()
for (unsigned int i = 0; i < mselected.size(); i++) {
// copying read only clipboard PartialProfile to a temporary one, initialized to the thumb's ProcParams
mselected[i]->thumbnail->createProcParamsForUpdate(false, false); // this can execute customprofilebuilder to generate param file
rtengine::procparams::PartialProfile cbPartProf = clipboard.getPartialProfile();
const rtengine::procparams::PartialProfile& cbPartProf = clipboard.getPartialProfile();
rtengine::procparams::PartialProfile pastedPartProf(&mselected[i]->thumbnail->getProcParams (), nullptr);
// pushing the selected values of the clipboard PartialProfile to the temporary PartialProfile