This commit is contained in:
Kim Kulling
2017-06-19 21:07:18 +02:00
parent d3140a68ab
commit 51b915c97b
9 changed files with 176 additions and 106 deletions

View File

@@ -68,8 +68,8 @@ DDLNode::DDLNode( const std::string &type, const std::string &name, size_t idx,
}
DDLNode::~DDLNode() {
releaseDataType<Property>( m_properties );
releaseDataType<Value>( m_value );
delete m_properties;
delete m_value;
releaseReferencedNames( m_references );
delete m_dtArrayList;
@@ -77,6 +77,9 @@ DDLNode::~DDLNode() {
if( s_allocatedNodes[ m_idx ] == this ) {
s_allocatedNodes[ m_idx ] = ddl_nullptr;
}
for ( size_t i = 0; i<m_children.size(); i++ ){
delete m_children[ i ];
}
}
void DDLNode::attachParent( DDLNode *parent ) {
@@ -91,9 +94,8 @@ void DDLNode::attachParent( DDLNode *parent ) {
}
void DDLNode::detachParent() {
if( m_parent ) {
std::vector<DDLNode*>::iterator it;
it = std::find( m_parent->m_children.begin(), m_parent->m_children.end(), this );
if( ddl_nullptr != m_parent ) {
DDLNodeIt it = std::find( m_parent->m_children.begin(), m_parent->m_children.end(), this );
if( m_parent->m_children.end() != it ) {
m_parent->m_children.erase( it );
}
@@ -126,6 +128,8 @@ const std::string &DDLNode::getName() const {
}
void DDLNode::setProperties( Property *prop ) {
if(m_properties!=ddl_nullptr)
delete m_properties;
m_properties = prop;
}
@@ -197,7 +201,7 @@ DDLNode *DDLNode::create( const std::string &type, const std::string &name, DDLN
void DDLNode::releaseNodes() {
if( s_allocatedNodes.size() > 0 ) {
for( DllNodeList::iterator it = s_allocatedNodes.begin(); it != s_allocatedNodes.end(); it++ ) {
for( DDLNodeIt it = s_allocatedNodes.begin(); it != s_allocatedNodes.end(); it++ ) {
if( *it ) {
delete *it;
}