t_max_err dbviewer_notify(t_dbviewer *x, t_symbol *s, t_symbol *msg, void *sender, void *data) { if(sender == x->d_view){ if(msg == ps_dbview_update){ dbviewer_bang(x); } else if(msg == ps_dbview_query_changed){ // dump all of the columns t_object *column = NULL; t_symbol **column_names = NULL; long numcolumns = 0; long i; hashtab_getkeys(x->d_columns, &numcolumns, &column_names); if(column_names){ for(i=0; i<numcolumns; i++){ column = jdataview_getnamedcolumn(x->d_dataview, column_names[i]); if(column) jdataview_deletecolumn(x->d_dataview, column); } sysmem_freeptr(column_names); } hashtab_clear(x->d_columns); } else if(msg == _sym_free){ object_detach_byptr((t_object *)x, x->d_view); x->d_view = NULL; } } return jbox_notify((t_jbox*)x, s, msg, sender, data); }
// Memory Deallocation void UnpackFree(UnpackPtr self) { dsp_free((t_pxobject*)self); if (self->patcherview) { object_detach_byptr(self, self->patcherview); self->patcherview = NULL; } TTObjectBaseRelease((TTObjectBasePtr*)&self->audioGraphObject); qelem_free(self->qelem); }
void connect_free(t_connect *x) { if(x->f_patcherview) object_detach_byptr(x, x->f_patcherview); delete x->f_ambi2D; delete x->f_ambi3D; delete [] x->f_objects; }
void PlugOutFree(PlugOutPtr self) { if (self->patcherview) { object_detach_byptr(self, self->patcherview); self->patcherview = NULL; } TTObjectBaseRelease((TTObjectBasePtr*)&self->audioGraphObject); qelem_free(self->qelem); delete self->buildThread; }
void iterator_free(t_iterator *x) { t_object *jp = NULL; t_object *pv; // detach from any objects that you have attached to. object_obex_lookup(x, gensym("#P"), &jp); if (jp) { pv = jpatcher_get_firstview(jp); object_detach_byptr(x, pv); } }
void hub_notify(t_hub *x, t_symbol *s, t_symbol *msg, void *sender, void *data) { if(sender == x->preset_interface){ if(msg == _sym_attr_modified){ t_symbol* name; name = (t_symbol *)object_method((t_object *)data, _sym_getname); } else if(msg == _sym_free){ object_detach_byptr(x, x->preset_interface); x->preset_interface = NULL; } } }
void paramui_free(t_paramui *x) { jbox_free(&x->box); qelem_free(x->menu_qelem); x->menu_qelem = NULL; object_free(x->menu_items); object_detach_byptr(x, x->obj_parameter); if(x->layout_value) jtextlayout_destroy(x->layout_value); if(x->layout_unit) jtextlayout_destroy(x->layout_unit); object_free(x->obj_parameter); }
// Memory Deallocation void OutFree(OutPtr self) { dsp_free((t_pxobject*)self); object_free(self->clock); if (self->patcherview) { object_detach_byptr(self, self->patcherview); self->patcherview = NULL; } if (self->output_buffer) free(self->output_buffer); TTObjectBaseRelease((TTObjectBasePtr*)&self->audioGraphObject); qelem_free(self->qelem); }
t_max_err wrappedModularClass_notify(TTPtr self, t_symbol *s, t_symbol *msg, void *sender, void *data) { WrappedModularInstancePtr x = (WrappedModularInstancePtr)self; ModularSpec* spec = (ModularSpec*)x->wrappedClassDefinition->specificities; TTValue v; TTAddress contextAddress; #ifndef ARRAY_EXTERNAL t_object * context; if (x->subscriberObject.valid()) { x->subscriberObject.get("context", v); context = (t_object*)((TTPtr)v[0]); // if the patcher is deleted if (sender == context) { if (msg == _sym_free) { // delete the context node if it exists x->subscriberObject.get("contextAddress", v); contextAddress = v[0]; MaxApplication.send("ObjectUnregister", contextAddress); // delete x->subscriberObject = TTObject(); // no more notification object_detach_byptr((t_object*)x, context); } } } #endif if (spec->_notify) spec->_notify(self, s, msg, sender, data); return MAX_ERR_NONE; }
t_max_err ww_notify(t_ww *x, t_symbol *s, t_symbol *msg, void *sender, void *data) { t_symbol *name = NULL; t_rect r; t_atom a[4]; if (sender == x->w_patcherview) { if (msg == gensym("attr_modified")) { name = (t_symbol *)object_method((t_object *)data, gensym("getname")); // the patcherview is notified when its rect changes size if (name == gensym("rect")) { object_attr_get_rect(x->w_patcherview, gensym("rect"), &r); atom_setfloat(a+0, r.x); atom_setfloat(a+1, r.y); atom_setfloat(a+2, r.width); atom_setfloat(a+3, r.height); outlet_anything(x->w_outlet, gensym("patcherview"), 4, a); } // the patcherview is notified when its visible rect has changed (i.e. scrollbars have been moved) if (name == gensym("visiblecanvasrect")) { object_attr_get_rect(x->w_patcherview,gensym("visiblecanvasrect"), &r); atom_setfloat(a+0, r.x); atom_setfloat(a+1, r.y); atom_setfloat(a+2, r.width); atom_setfloat(a+3, r.height); outlet_anything(x->w_outlet, gensym("visiblecanvasrect"), 4, a); } } else if (msg == gensym("free")) { object_detach_byptr((t_object *)x, x->w_patcherview); x->w_patcherview = NULL; } } return MAX_ERR_NONE; }
void ww_free(t_ww *x) { if(x->w_patcherview) object_detach_byptr((t_object *)x, x->w_patcherview); }
void connect_free(t_connect *x) { if(x->f_patcherview) object_detach_byptr(x, x->f_patcherview); }