From d6d1febfad6698f55f077b7dd94330a46da83886 Mon Sep 17 00:00:00 2001 From: Thomas Grill Date: Mon, 18 Apr 2005 15:07:41 +0000 Subject: changed template parameter of TableMap fixed problems with symbol binding restructured TableMap type (doesn't own pointers any more) svn path=/trunk/; revision=2779 --- externals/grill/flext/source/flitem.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'externals/grill/flext/source/flitem.cpp') diff --git a/externals/grill/flext/source/flitem.cpp b/externals/grill/flext/source/flitem.cpp index 4cab1481..057f1d44 100755 --- a/externals/grill/flext/source/flitem.cpp +++ b/externals/grill/flext/source/flitem.cpp @@ -15,6 +15,14 @@ WARRANTIES, see the file, "license.txt," in this distribution. #include "flext.h" #include +flext_base::ItemSet::~ItemSet() { clear(); } + +void flext_base::ItemSet::clear() +{ + for(iterator it(*this); it; ++it) delete it.data(); + TablePtrMap::clear(); +} + flext_base::Item::~Item() { @@ -57,8 +65,10 @@ void flext_base::ItemCont::Add(Item *item,const t_symbol *tag,int inlet) if(!Contained(inlet)) Resize(inlet+2); ItemSet &set = GetInlet(inlet); Item *lst = set.find(tag); - if(!lst) - set.insert(tag,lst = item); + if(!lst) { + Item *old = set.insert(tag,lst = item); + FLEXT_ASSERT(!old); + } else for(;;) if(!lst->nxt) { lst->nxt = item; break; } @@ -76,8 +86,10 @@ bool flext_base::ItemCont::Remove(Item *item,const t_symbol *tag,int inlet,bool for(Item *prv = NULL; lit; prv = lit,lit = lit->nxt) { if(lit == item) { if(prv) prv->nxt = lit->nxt; - else if(lit->nxt) - set.insert(tag,lit->nxt); + else if(lit->nxt) { + Item *old = set.insert(tag,lit->nxt); + FLEXT_ASSERT(!old); + } else { Item *l = set.remove(tag); FLEXT_ASSERT(l == lit); -- cgit v1.2.1