Fwk : Added DEBUG assert to detect when data is present in child fields

Added assert for ChildArrayField and ChildField
This commit is contained in:
Magne Sjaastad 2015-12-09 13:34:13 +01:00
parent 5e6fc505d0
commit a86d24df97
2 changed files with 11 additions and 0 deletions

View File

@ -15,6 +15,13 @@ 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();
}

View File

@ -52,6 +52,10 @@ caf::PdmChildField<DataType*>::PdmChildField(const DataTypePtr& fieldValue)
template<typename DataType >
caf::PdmChildField<DataType*>::~PdmChildField()
{
#ifdef _DEBUG
assert(m_fieldValue.isNull());
#endif
if (!m_fieldValue.isNull()) m_fieldValue.rawPtr()->removeAsParentField(this);
m_fieldValue.setRawPtr(NULL);
}