aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/flext/source/flbind.cpp
diff options
context:
space:
mode:
authorThomas Grill <xovo@users.sourceforge.net>2003-06-10 02:33:37 +0000
committerThomas Grill <xovo@users.sourceforge.net>2003-06-10 02:33:37 +0000
commit5a33517fef170ceb104b35aa690fdadcb0cf292b (patch)
tree0c5740af99d57fbf9e8de3bfe8cd05e150c70df0 /externals/grill/flext/source/flbind.cpp
parentd97d46e2806969c994647ee8e3ce64b4f3d1d9f6 (diff)
""
svn path=/trunk/; revision=687
Diffstat (limited to 'externals/grill/flext/source/flbind.cpp')
-rw-r--r--externals/grill/flext/source/flbind.cpp27
1 files changed, 26 insertions, 1 deletions
diff --git a/externals/grill/flext/source/flbind.cpp b/externals/grill/flext/source/flbind.cpp
index a0af2ce0..4422eac6 100644
--- a/externals/grill/flext/source/flbind.cpp
+++ b/externals/grill/flext/source/flbind.cpp
@@ -99,6 +99,11 @@ bool flext_base::BindMethod(const t_symbol *sym,bool (*fun)(flext_base *,t_symbo
post("%s - Symbol already bound",thisName());
return false;
}
+
+ if(bindhead->Count() > 20) {
+ // Hash it!
+ bindhead->Finalize();
+ }
}
SetupBindProxy();
@@ -152,7 +157,7 @@ bool flext_base::UnbindMethod(const t_symbol *sym,bool (*fun)(flext_base *,t_sym
if(!sz) sz = 1;
for(int i = 0; i < sz; ++i) {
- for(it = (binditem *)bindhead->Item(0); it; it = (binditem *)it->nxt) {
+ for(it = (binditem *)bindhead->Item(i); it; it = (binditem *)it->nxt) {
if(it->tag == sym && (!fun || it->fun == fun)) break;
}
if(it) break;
@@ -167,6 +172,26 @@ bool flext_base::UnbindMethod(const t_symbol *sym,bool (*fun)(flext_base *,t_sym
return ok;
}
+bool flext_base::UnbindAll()
+{
+// bool memleak = false;
+
+ int sz = bindhead->Size();
+ if(!sz) sz = 1;
+
+ for(int i = 0; i < sz; ++i) {
+ for(binditem *it = (binditem *)bindhead->Item(i); it; it = (binditem *)it->nxt) {
+// if(it->px->data) memleak = true;
+ if(bindhead->Remove(it)) delete it;
+ }
+ }
+/*
+ if(memleak)
+ post("%s - Memory was not deallocated while unbinding methods",thisName());
+*/
+ return true;
+}
+
void flext_base::pxbnd_object::px_method(pxbnd_object *c,const t_symbol *s,int argc,t_atom *argv)
{
c->item->fun(c->base,(t_symbol *)s,argc,(t_atom *)argv,c->data);