diff -r d8a3531bc6b8 -r 433cbbb6a04b uiacceltk/hitchcock/ServerCore/Src/alfnodes.cpp --- a/uiacceltk/hitchcock/ServerCore/Src/alfnodes.cpp Mon Feb 22 17:57:49 2010 +0200 +++ b/uiacceltk/hitchcock/ServerCore/Src/alfnodes.cpp Fri Mar 12 15:47:04 2010 +0200 @@ -61,20 +61,14 @@ } } // --------------------------------------------------------------------------- -// OrphonMe +// OrphanMe // --------------------------------------------------------------------------- // -CAlfNode* CAlfNode::OrphonMe() +CAlfNode* CAlfNode::OrphanMe() + { - __ALFLOGSTRING1("CAlfNode::OrphonMe %d", iId); - // this window will not be used anymore by wserv and cannot be drawn into. Thus destroying the - // visual representing this node is safe. - if ( iWindow && iModel ) - { - iModel->Server().WindowMgr()->DestroyWindow( *iWindow ); - iWindow = NULL; - } - + __ALFLOGSTRING1("CAlfNode::OrphanMe %d", iId); + // Parent node has been deleted. Orphan the node: remove the parent/sibling relationship. CAlfNode* sibling = iSibling; iSibling = NULL; iParent = NULL; @@ -1174,6 +1168,11 @@ CAlfNode::~CAlfNode() { __ALFLOGSTRING1("CAlfNode::~CAlfNode %d", iId); + if ( iWindow && iModel ) // just in case: the window should be deleted already + { + iModel->Server().WindowMgr()->DestroyWindow( *iWindow ); + iWindow = NULL; + } } // --------------------------------------------------------------------------- @@ -1233,11 +1232,11 @@ __ALFLOGSTRING1("My parent says, that I'm not his child :..( or no parent %d ", iParent ); } - // Orphon all the children + // Orphan all the children CAlfNode* child = iChild; while( child ) { - child = child->OrphonMe(); + child = child->OrphanMe(); } iChild = NULL; if ( iModel ) @@ -1680,6 +1679,7 @@ if ( iWindow && iModel ) { iModel->Server().WindowMgr()->DestroyWindow( *iWindow ); + iWindow = NULL; // make sure there is no double deletion } } @@ -1944,7 +1944,8 @@ iModel->Server().Bridge()->AddData( EAlfDSDestroyWindow, iGroupId, iId, - (TAny*)offset ); + (TAny*)offset ); + iWindow = 0; // just in case } RemoveDependencies( iParent->iChild ); };