/*------------------------------------ releaseObjectMemory ---*/ void releaseObjectMemory(UdpObjectData * xx) { if (xx) { if (xx->fErrorQueue) { qelem_unset(xx->fErrorQueue); qelem_free(xx->fErrorQueue); xx->fErrorQueue = NULL; } if (xx->fReceiveQueue) { qelem_unset(xx->fReceiveQueue); qelem_free(xx->fReceiveQueue); xx->fReceiveQueue = NULL; } xx->fReceiveBuffer = xx->fSendBuffer = NULL; if (xx->fBufferBase) { sysmem_lockhandle(reinterpret_cast<t_handle>(xx->fBufferBase), 0); sysmem_freehandle(reinterpret_cast<t_handle>(xx->fBufferBase)); xx->fBufferBase = NULL; } xx->fReceiveHead = xx->fReceiveTail = xx->fPoolHead = xx->fPoolTail = NULL; if (xx->fLinkBase) { sysmem_lockhandle(reinterpret_cast<t_handle>(xx->fLinkBase), 0); sysmem_freehandle(reinterpret_cast<t_handle>(xx->fLinkBase)); xx->fLinkBase = NULL; } } } // releaseObjectMemory
/*------------------------------------ senseXFree ---*/ static void senseXFree(SenseXData * xx) { if (xx) { xx->fStopping = true; if (xx->fPollClock) { clock_unset(xx->fPollClock); clock_free(reinterpret_cast<t_object *>(xx->fPollClock)); xx->fPollClock = NULL; } if (xx->fPollQueue) { qelem_unset(xx->fPollQueue); qelem_free(xx->fPollQueue); xx->fPollQueue = NULL; } if (xx->fProxy) { freeobject(reinterpret_cast<t_object *>(xx->fProxy)); xx->fProxy = NULL; } } } // senseXFree
/*------------------------------------ x10Free ---*/ static void x10Free(X10ControlData * xx) { if (xx) { xx->fStopping = true; if (xx->fPollClock) { clock_unset(xx->fPollClock); clock_free(reinterpret_cast<t_object *>(xx->fPollClock)); xx->fPollClock = NULL; } if (xx->fPollQueue) { qelem_unset(xx->fPollQueue); qelem_free(xx->fPollQueue); xx->fPollQueue = NULL; } FREE_BYTES(xx->fOutBuffer); } } // x10Free
// TODO: When running in the debugger, it seems like we are iterating through this function a whole bunch of times! // Can we put it in a qelem or something so that it only gets called once? [TAP] // But actually, maybe it is just a Max 4.6 funky Runtime thing? Let's take a look again when we get to Max 5 void hub_examine_context(t_hub *x) { AtomCount argc = 0; AtomPtr argv = NULL; SymbolPtr context = jamoma_patcher_getcontext(x->container); // Try to get OSC Name of module from an argument jamoma_patcher_getargs(x->container, &argc, &argv); // <-- this call allocates memory for argv if(argc){ x->osc_name = atom_getsym(argv+(argc-1)); sysmem_freeptr(argv); } else x->osc_name = _sym_nothing; // Try to get OSC Name of module from scripting name if(x->osc_name == _sym_nothing) x->osc_name = jamoma_patcher_getvarname(x->container); // In this case we overwrite whatever happened above if(context == gensym("toplevel")){ x->osc_name = gensym("/editing_this_module"); x->editing = true; } else{ t_object* patcher = jamoma_object_getpatcher((t_object*)x); t_object* box = object_attr_getobj(patcher, jps_box); t_object* ui = NULL; t_symbol* objclass = NULL; x->editing = false; ui = object_attr_getobj(patcher, gensym("firstobject")); while(ui){ objclass = object_attr_getsym(ui, gensym("maxclass")); if(objclass == gensym("jcom.ui")) break; ui = object_attr_getobj(ui, gensym("nextobject")); } if(ui){ t_rect boxRect; t_rect uiRect; if(context == gensym("bpatcher")){ object_attr_get_rect(ui, _sym_presentation_rect, &uiRect); object_attr_get_rect(box, _sym_patching_rect, &boxRect); boxRect.width = uiRect.width; boxRect.height = uiRect.height; object_attr_set_rect(box, _sym_patching_rect, &boxRect); object_attr_get_rect(box, _sym_presentation_rect, &boxRect); boxRect.width = uiRect.width; boxRect.height = uiRect.height; object_attr_set_rect(box, _sym_presentation_rect, &boxRect); } else if(context == gensym("subpatcher")){ object_attr_get_rect(ui, _sym_presentation_rect, &uiRect); object_attr_get_rect(patcher, _sym_defrect, &boxRect); boxRect.width = uiRect.width; boxRect.height = uiRect.height; object_attr_set_rect(patcher, _sym_defrect, &boxRect); object_attr_setchar(patcher, _sym_toolbarvisible, 0); } } } object_attr_setsym(x, _sym_name, x->osc_name); hub_subscriptions_refresh(x); hub_internals_create(x); qelem_unset(x->init_qelem); // clear the last thing to make sure we don't call into this a bunch of times qelem_set(x->init_qelem); // flag the queue for initialization }
void QueueRamp::stop() { active = 0; qelem_unset(qelem); }
QueueRamp::~QueueRamp() { qelem_unset(qelem); qelem_free(qelem); }