From f5ec81782911d5708a89b625ebfaaf8d343c2e78 Mon Sep 17 00:00:00 2001 From: vro Date: Thu, 27 Feb 2014 18:43:38 +0400 Subject: [PATCH] 0024645: Pointer to the last is wrong for a tree node Information on last child is added to the Dump() method + fixed a problem of lost last child tree node on removal (detach) operation. Test case for issue CR24645 --- src/TDataStd/TDataStd_TreeNode.cxx | 11 ++++---- tests/bugs/caf/bug24645 | 45 ++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 6 deletions(-) create mode 100644 tests/bugs/caf/bug24645 diff --git a/src/TDataStd/TDataStd_TreeNode.cxx b/src/TDataStd/TDataStd_TreeNode.cxx index 1b0b66437f..de47e20c29 100644 --- a/src/TDataStd/TDataStd_TreeNode.cxx +++ b/src/TDataStd/TDataStd_TreeNode.cxx @@ -235,12 +235,7 @@ Standard_Boolean TDataStd_TreeNode::Remove () } if(Father()->HasLast()) { - if (Handle(TDataStd_TreeNode)::DownCast(this) == Father()->Last()) { - if(HasPrevious()) { - Father()->SetLast(Previous()); - } - else Father()->SetLast(bid); - } + Father()->SetLast(bid); } SetFather(bid); @@ -698,6 +693,10 @@ Standard_OStream& TDataStd_TreeNode::Dump (Standard_OStream& anOS) const anOS<<" First="; if (!myFirst->Label().IsNull()) myFirst->Label().EntryDump(anOS); } + if (myLast) { + anOS<<" Last="; + if (!myLast->Label().IsNull()) myLast->Label().EntryDump(anOS); + } anOS<