void DRInterface::releaseMem(DRInterface* data, const char* dllname) { if(!data) LOG_ERROR_VOID("data, ZERO-POINTER"); if(!mDLL) { if(!loadDll(dllname)) { LOG_WARNING("keine dll"); DR_SAVE_DELETE(data); } } if(!releaseInstance) loadDll(dllname); if(releaseInstance) { releaseInstance(data); } else { LOG_WARNING("function didn't exist in dll"); DR_SAVE_DELETE(data); } }
void InstanceManager::unpublishInstance( const std::string& key ) { std::map<std::string, co::int32>::iterator it = _published.find( key ); assert( it != _published.end() ); releaseInstance( it->second ); }
TTErr TTEnvironment::createInstance(const TTSymbolPtr className, TTObjectPtr* anObject, TTValue& anArgument) { TTValue v; TTClassPtr theClass; TTErr err; TTObjectPtr newObject = NULL; TTObjectPtr oldObject = NULL; err = classes->lookup(className, v); if (!err) { theClass = TTClassPtr(TTPtr(v)); if (theClass) err = theClass->createInstance(&newObject, anArgument); else err = kTTErrGeneric; } if (!err && newObject) { if (*anObject) oldObject = *anObject; *anObject = newObject; if (oldObject) releaseInstance(&oldObject); (*anObject)->classPtr = theClass; (*anObject)->valid = true; } //TODO: Add instance tracking. For each instance of a class, we push the instance onto a linked list of instances for that class // When the object is freed using deleteInstance(), then we pop it. // What would this achieve? // - we could check statistics on them or do other logging // - we could access instances remotely, and perhaps then manipulate them remotely in a shared manner // - if an object is referenced by another object, and thus shared, then we need to reference counting here before freeing. // THEREFORE: we should have an addReference() and release() method (instead of a deleteInstance() method). // - the reference counting itself should probably be done inside of TTObject though, yes? return err; }