summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--slicer/slicer/modelParts.h1
-rw-r--r--slicer/slicer/modelPartsTypes.h3
-rw-r--r--slicer/slicer/modelPartsTypes.impl.h4
3 files changed, 4 insertions, 4 deletions
diff --git a/slicer/slicer/modelParts.h b/slicer/slicer/modelParts.h
index de6e89f..8adc8f2 100644
--- a/slicer/slicer/modelParts.h
+++ b/slicer/slicer/modelParts.h
@@ -78,7 +78,6 @@ namespace Slicer {
class ModelPartForRootBase;
class HookCommon;
- using ModelPartUPtr = std::unique_ptr<ModelPart>;
using ModelPartParam = any_ptr<ModelPart>;
using ModelPartForRootParam = any_ptr<ModelPartForRootBase>;
using TypeId = std::optional<std::string>;
diff --git a/slicer/slicer/modelPartsTypes.h b/slicer/slicer/modelPartsTypes.h
index f8a8814..2079195 100644
--- a/slicer/slicer/modelPartsTypes.h
+++ b/slicer/slicer/modelPartsTypes.h
@@ -113,7 +113,7 @@ namespace Slicer {
protected:
virtual bool hasModel() const = 0;
- ModelPartUPtr modelPart;
+ ModelPart * modelPart;
};
template<typename T>
@@ -129,6 +129,7 @@ namespace Slicer {
protected:
bool hasModel() const override;
+ std::optional<T> modelPartOwner;
};
class DLL_PUBLIC ModelPartForComplexBase : public ModelPart {
diff --git a/slicer/slicer/modelPartsTypes.impl.h b/slicer/slicer/modelPartsTypes.impl.h
index dc6ff07..ad1a90f 100644
--- a/slicer/slicer/modelPartsTypes.impl.h
+++ b/slicer/slicer/modelPartsTypes.impl.h
@@ -306,7 +306,7 @@ namespace Slicer {
ModelPartModel<Ice::optional<typename T::element_type>>(h)
{
if (this->Model && *this->Model) {
- modelPart = std::make_unique<T>(&**this->Model);
+ modelPart = &modelPartOwner.emplace(&**this->Model);
}
}
@@ -325,7 +325,7 @@ namespace Slicer {
BOOST_ASSERT(this->Model);
if (!*this->Model) {
*this->Model = typename T::element_type();
- modelPart = std::make_unique<T>(&**this->Model);
+ modelPart = &modelPartOwner.emplace(&**this->Model);
modelPart->Create();
}
}