[dasher] Always Leave() nodes we Enter() - inc. in InitialiseAtOffset & ~CDasherModel



commit d86356169c28256cdccdb01427f3dc93f3e81315
Author: Alan Lawrence <acl33 inf phy cam ac uk>
Date:   Wed Jun 2 11:48:25 2010 +0100

    Always Leave() nodes we Enter() - inc. in InitialiseAtOffset & ~CDasherModel
    
    Fixes e.g. slowdown continuing after rebuilding model when inside a control node

 Src/DasherCore/DasherModel.cpp |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/Src/DasherCore/DasherModel.cpp b/Src/DasherCore/DasherModel.cpp
index 133f696..7d08ddb 100644
--- a/Src/DasherCore/DasherModel.cpp
+++ b/Src/DasherCore/DasherModel.cpp
@@ -65,7 +65,7 @@ CDasherModel::CDasherModel(CEventHandler *pEventHandler,
   DASHER_ASSERT(m_pNodeCreationManager != NULL);
   DASHER_ASSERT(m_pDasherInterface != NULL);
 
-  m_Root = NULL;
+  m_pLastOutput = m_Root = NULL;
 
   m_Rootmin = 0;
   m_Rootmax = 0;
@@ -91,14 +91,14 @@ CDasherModel::CDasherModel(CEventHandler *pEventHandler,
 }
 
 CDasherModel::~CDasherModel() {
+  if (m_pLastOutput) m_pLastOutput->Leave();
+  
   if(oldroots.size() > 0) {
     delete oldroots[0];
     oldroots.clear();
     // At this point we have also deleted the root - so better NULL pointer
     m_Root = NULL;
-  }
-
-  if(m_Root) {
+  } else {
     delete m_Root;
     m_Root = NULL;
   }
@@ -284,6 +284,7 @@ void CDasherModel::DeleteTree() {
 }
 
 void CDasherModel::InitialiseAtOffset(int iOffset, CDasherView *pView) {
+  if (m_pLastOutput) m_pLastOutput->Leave();
   DeleteTree();
 
   m_Root = m_pNodeCreationManager->GetAlphRoot(NULL, 0,GetLongParameter(LP_NORMALIZATION), iOffset!=0, iOffset);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]