interface
| 5735 | |
| 5736 | // interface |
| 5737 | void asCScriptEngine::ReleaseScriptObject(void *obj, const asITypeInfo *type) |
| 5738 | { |
| 5739 | // Make sure it is not a null pointer |
| 5740 | if( obj == 0 || type == 0 ) return; |
| 5741 | |
| 5742 | const asCTypeInfo *ti = reinterpret_cast<const asCTypeInfo*>(type); |
| 5743 | if (ti->flags & asOBJ_FUNCDEF) |
| 5744 | { |
| 5745 | CallObjectMethod(obj, functionBehaviours.beh.release); |
| 5746 | } |
| 5747 | else |
| 5748 | { |
| 5749 | asCObjectType *objType = CastToObjectType(const_cast<asCTypeInfo*>(ti)); |
| 5750 | if (objType && objType->flags & asOBJ_REF) |
| 5751 | { |
| 5752 | asASSERT((objType->flags & asOBJ_NOCOUNT) || objType->beh.release); |
| 5753 | if (objType->beh.release) |
| 5754 | { |
| 5755 | // Call the release behaviour |
| 5756 | CallObjectMethod(obj, objType->beh.release); |
| 5757 | } |
| 5758 | } |
| 5759 | else if( objType ) |
| 5760 | { |
| 5761 | // Call the destructor |
| 5762 | if (objType->beh.destruct) |
| 5763 | CallObjectMethod(obj, objType->beh.destruct); |
| 5764 | else if (objType->flags & asOBJ_LIST_PATTERN) |
| 5765 | DestroyList((asBYTE*)obj, objType); |
| 5766 | |
| 5767 | // We'll have to trust that the memory for the object was allocated with CallAlloc. |
| 5768 | // This is true if the object was created in the context, or with CreateScriptObject. |
| 5769 | |
| 5770 | // Then free the memory |
| 5771 | CallFree(obj); |
| 5772 | } |
| 5773 | } |
| 5774 | } |
| 5775 | |
| 5776 | // interface |
| 5777 | int asCScriptEngine::BeginConfigGroup(const char *groupName) |