# HG changeset patch # User phoku@33b003aa-7bff-0310-803a-e67f0ece8222 # Date 1237485419 0 # Node ID 852da06fc922e426fdbc408ef6b8f88de7d47394 # Parent 724f3a5f3e96266c3f329608678453477cec5121 Moved the removal of deletelistener in instance.cpp to finalizeAction to assure that no duplicate addDeleteLstener calls lead to segfaults. Whitespace cleanup. diff -r 724f3a5f3e96 -r 852da06fc922 engine/core/model/structures/instance.cpp --- a/engine/core/model/structures/instance.cpp Thu Mar 19 17:14:56 2009 +0000 +++ b/engine/core/model/structures/instance.cpp Thu Mar 19 17:56:59 2009 +0000 @@ -170,17 +170,17 @@ } Instance::~Instance() { - std::vector::iterator itor; - for(itor = m_deletelisteners.begin(); - itor != m_deletelisteners.end(); - ++itor) { - (*itor)->onInstanceDeleted(this); - } - if(m_activity && - m_activity->m_actioninfo && - m_activity->m_actioninfo->m_leader) { - m_activity->m_actioninfo->m_leader->removeDeleteListener(this); - } + std::vector::iterator itor; + for(itor = m_deletelisteners.begin(); + itor != m_deletelisteners.end(); + ++itor) { + (*itor)->onInstanceDeleted(this); + } + + if(m_activity && m_activity->m_actioninfo) { + finalizeAction(); + } + delete m_activity; delete m_facinglocation; delete m_visual; @@ -401,6 +401,10 @@ assert(m_activity); assert(m_activity->m_actioninfo); + if( m_activity->m_actioninfo->m_leader ) { + m_activity->m_actioninfo->m_leader->removeDeleteListener(this); + } + Action* action = m_activity->m_actioninfo->m_action; delete m_activity->m_actioninfo; m_activity->m_actioninfo = NULL;