freeobject and proxies
hi, i'm having the trouble of max crashing whenever i unload my external,
i think it is an issue of me incorrectly attempting to free some proxies.
am i unclear on the syntax or is there something i'm overlooking? any
help would be appreciated. - dan
(also i notice that there is now a development forum, is it inappropriate
to ask these kinds of questions over the main list?)
code examples
----
here i predeclare them:
typedef struct _comb{
t_pxobject x_obj;
void *t_proxy[4];
float *data;
float *data2;
long InletNum;
long index;
long index2;
long allocsize;
long size;
float A;
float B;
float C;
long Delay;
long samperms;
} t_comb;
...
then i reference a free routine in main:
void main (void)
{
setup((t_messlist**)&comb_class, (method)create_object,
(method)destroy_object, (short)sizeof(t_comb), NULL, A_DEFLONG,
A_NOTHING);
...
i declare them as inlets:
void *create_object(long maxsize)
{
t_comb *mo = (t_comb*)newobject(comb_class);
mo->t_proxy[3] = proxy_new(mo, 4, &mo->InletNum);
mo->t_proxy[2] = proxy_new(mo, 3, &mo->InletNum);
mo->t_proxy[1] = proxy_new(mo, 2, &mo->InletNum);
mo->t_proxy[0] = proxy_new(mo, 1, &mo->InletNum);
...
and later attempt to free them:
void destroy_object(t_comb *mo)
{
free(mo->data);
free(mo->data2);
freeobject(mo->t_proxy[4]);
mo->data = mo->data2 = NULL;
mo->allocsize = mo->size = mo->index = mo-> index2 = 0;
dsp_free(&(mo->x_obj));
}
You are freeing a piece of memory you don't own.
freeobject(mo->t_proxy[0]);
freeobject(mo->t_proxy[1]);
freeobject(mo->t_proxy[2]);
freeobject(mo->t_proxy[3]);
Am 14.02.2006 um 05:43 schrieb daniel e mcanulty:
> freeobject(mo->t_proxy[4]);
Ah, this is good to realize, unfortunately i have tried this and also tried it again just now, but the external continues to give me this same problem. What else could i be doing wrong?
Dan