mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-10 08:03:05 -06:00
#1232 Delete child objects in destructor of ChildField and ChildArrayField
This commit is contained in:
parent
41fada4d1f
commit
03adf8f759
@ -15,14 +15,7 @@ namespace caf
|
||||
template<typename DataType>
|
||||
PdmChildArrayField<DataType*>::~PdmChildArrayField()
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
for (size_t index = 0; index < m_pointers.size(); ++index)
|
||||
{
|
||||
assert(m_pointers.at(index).isNull());
|
||||
}
|
||||
#endif
|
||||
|
||||
this->removeThisAsParentField();
|
||||
deleteAllChildObjects();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -52,11 +52,7 @@ caf::PdmChildField<DataType*>::PdmChildField(const DataTypePtr& fieldValue)
|
||||
template<typename DataType >
|
||||
caf::PdmChildField<DataType*>::~PdmChildField()
|
||||
{
|
||||
bool The_object_owned_by_the_child_field_is_deleted = m_fieldValue.isNull();
|
||||
assert(The_object_owned_by_the_child_field_is_deleted); // Did you forget ?
|
||||
|
||||
if (!m_fieldValue.isNull()) m_fieldValue.rawPtr()->removeAsParentField(this);
|
||||
m_fieldValue.setRawPtr(NULL);
|
||||
delete m_fieldValue.rawPtr();
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user