summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2012-10-30 16:24:18 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2012-10-30 16:25:36 -0400
commit9106fc3aa811002bf66b69951a754daccff98d67 (patch)
treec925d9b1658a24389d5d5dcd535094f515163d90
parent2f6dcb048c3acd60099ca316082e284fb69ef55d (diff)
Avoiding deleting the removed entry.
The tree list entries are now stored in ptr_vector. We no longer have to manually call delete on it whenever it gets removed from the list. Change-Id: Id183aadbdc3b1565d1c702dc0fc099df9dcb6e2c
-rw-r--r--svtools/source/contnr/treelist.cxx5
1 files changed, 2 insertions, 3 deletions
diff --git a/svtools/source/contnr/treelist.cxx b/svtools/source/contnr/treelist.cxx
index 1716e27021c0..f3bf0bc2bf4f 100644
--- a/svtools/source/contnr/treelist.cxx
+++ b/svtools/source/contnr/treelist.cxx
@@ -1257,6 +1257,8 @@ bool SvTreeList::Remove( const SvTreeListEntry* pEntry )
SvTreeListEntries& rList = pParent->maChildren;
bool bLastEntry = false;
+ Broadcast(LISTACTION_REMOVED, const_cast<SvTreeListEntry*>(pEntry));
+
if ( pEntry->HasChildListPos() )
{
size_t nListPos = pEntry->GetChildListPos();
@@ -1273,7 +1275,6 @@ bool SvTreeList::Remove( const SvTreeListEntry* pEntry )
rList.erase(it);
}
-
// moved to end of method because it is used later with Broadcast
if (!rList.empty() && !bLastEntry)
@@ -1284,9 +1285,7 @@ bool SvTreeList::Remove( const SvTreeListEntry* pEntry )
#ifdef CHECK_INTEGRITY
CheckIntegrity();
#endif
- Broadcast(LISTACTION_REMOVED, const_cast<SvTreeListEntry*>(pEntry));
- delete pEntry; // deletes any children as well
return true;
}