[dasher] Fix: When RebuildParent-ing, set NF_SEEN on all created ancestors...



commit c59ae3a12a2ea14a89cfe86a2c2be43872f5724c
Author: Alan Lawrence <acl33 inf phy cam ac uk>
Date:   Mon Dec 14 21:40:39 2009 +0000

    Fix: When RebuildParent-ing, set NF_SEEN on all created ancestors...

 Src/DasherCore/AlphabetManager.cpp |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/Src/DasherCore/AlphabetManager.cpp b/Src/DasherCore/AlphabetManager.cpp
index fc347b9..a35f6d0 100644
--- a/Src/DasherCore/AlphabetManager.cpp
+++ b/Src/DasherCore/AlphabetManager.cpp
@@ -427,13 +427,21 @@ CDasherNode *CAlphabetManager::CAlphNode::RebuildParent(int iNewOffset) {
   
   CAlphNode *pNewNode = m_pMgr->BuildNodeForOffset(NULL, 0, 0, iNewOffset!=-1, iNewOffset);
 
-  pNewNode->SetFlag(NF_SEEN, true);
-
   //now fill in the new node - recursively - until it reaches us
   m_pMgr->IterateChildGroups(pNewNode, NULL, this);
 
   //finally return our immediate parent (pNewNode may be an ancestor rather than immediate parent!)
   DASHER_ASSERT(Parent() != NULL);
+
+  //although not required, we believe only NF_SEEN nodes are ever requested to rebuild their parents...
+  DASHER_ASSERT(GetFlag(NF_SEEN));
+  //so set NF_SEEN on all created ancestors (of which pNewNode is the last)
+  CDasherNode *pNode = this;
+  do {
+    pNode = pNode->Parent();
+    pNode->SetFlag(NF_SEEN, true);
+  } while (pNode != pNewNode);
+  
   return Parent();
 }
 



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