uiacceltk/hitchcock/ServerCore/Src/alfnodes.cpp
branchRCL_3
changeset 11 46927d61fef3
parent 10 88b23e2e82e1
child 34 3a60ebea00d0
--- a/uiacceltk/hitchcock/ServerCore/Src/alfnodes.cpp	Wed Mar 31 23:03:58 2010 +0300
+++ b/uiacceltk/hitchcock/ServerCore/Src/alfnodes.cpp	Wed Apr 14 16:53:50 2010 +0300
@@ -1082,9 +1082,18 @@
                 //                           ^^^ 
                 // if iterNode gets to NULL, then we must have found both matches 
                 // - i.e. either the new or current/old position is the rightmost node   
-                ASSERT(oldPrevNode!=NULL && newPrevNode!=NULL); 
+                if (oldPrevNode == NULL || newPrevNode == NULL )
+                    {
+                    // Fatal error! Node tree is corrupted.
+                    __ALFLOGSTRING4("CAlfNode::SiblingOrderChanged(). Fatal error! Node tree is corrupted. oldPrevNode=0x%x, newPrevNode=0x%x, iterNodePosition=%d, aNewPos=%d", 
+                            oldPrevNode, newPrevNode, iterNodePosition, aNewPos);                    
+                    __ALFLOGSTRING4("CAlfNode::SiblingOrderChanged(). This node=0x%x, type = %d, parent node=0x%x, parent type=%d", this, Type(), iParent, iParent->Type());
+                    __ALFLOGSTRING2("CAlfNode::SiblingOrderChanged(). This node id=0x%x, parent node id=0x%x", iId, iParent->iId);
+                    __ASSERT_ALWAYS(EFalse, USER_INVARIANT());    
+                    //__ASSERT_DEBUG(EFalse, USER_INVARIANT()); 
+                    return;  
+                    }
                 } 
-
             ASSERT(iterPrevNode!=NULL);                 
         } // end while loop 
 
@@ -2214,5 +2223,50 @@
         }
     }
 
+#ifdef __WINS__
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void CAlfNode::Debug_CheckSiblingOrder(const TDesC16& aContext)
+   {
+   if (!iParent || Type() != MWsWindowTreeNode::EWinTreeNodeClient)
+       {
+       return;
+       }
+   
+   TBool foundMyself = EFalse;
+   TInt iterNodePosition = 0; 
+   
+   // Search for myselk in iParent sibling list
+   for(CAlfNode* iterNode = iParent->iChild; iterNode != NULL; iterNode = iterNode->iSibling, iterNodePosition++)
+       {
+       if (iterNode == this) 
+           {
+           foundMyself = ETrue;
+           }  
+       }
+   
+   if(!foundMyself)
+       {
+       // Did not find myself from the parent sibling list ==> error!
+       __ALFLOGSTRING2("CAlfNode::Test_CheckSiblingOrder(). Fatal error! Node tree is corrupted.  at %S: iId=0x%x", &aContext, iId );                    
+       __ALFLOGSTRING3("CAlfNode::Test_CheckSiblingOrder(). iterNodePosition=%d, iChild=0x%x, iSibling=0x%x", iterNodePosition, iChild, iSibling );                    
+       __ALFLOGSTRING3("CAlfNode::Test_CheckSiblingOrder(). iSpriteChild=0x%x, iAnimChild=0x%x, iTextCursor=0x%x", iSpriteChild, iAnimChild, iTextCursor );                    
+       __ALFLOGSTRING4("CAlfNode::Test_CheckSiblingOrder(). This node=0x%x, type = %d, parent node=0x%x, parent type=%d", this, Type(), iParent, iParent->Type());
+       // Print sibling list
+       iterNodePosition=0;     
+       __ALFLOGSTRING("CAlfNode::Test_CheckSiblingOrder(). SIBLINGS:");
+       for(CAlfNode* iterNode2 = iParent->iChild; iterNode2!=NULL; iterNode2 = iterNode2->iSibling, iterNodePosition++)
+           {
+           __ALFLOGSTRING4("CAlfNode::Test_CheckSiblingOrder(). *** iterNodePosition=%d, id=%d, this=0x%x, iChild=0x%x", iterNodePosition, iterNode2->iId, iterNode2, iterNode2->iChild );                    
+           __ALFLOGSTRING3("CAlfNode::Test_CheckSiblingOrder(). iSpriteChild=0x%x, iAnimChild=0x%x, iTextCursor=0x%x", iterNode2->iSpriteChild, iterNode2->iAnimChild, iterNode2->iTextCursor );                    
+           }                 
+       
+       __ASSERT_ALWAYS(EFalse, USER_INVARIANT());   
+       }
+   }
+#endif
+
 // end of file