MCPcopy Create free account
hub / github.com/anjo76/angelscript / UninitializeGlobalProp

Method UninitializeGlobalProp

sdk/angelscript/source/as_module.cpp:476–515  ·  view source on GitHub ↗

internal

Source from the content-addressed store, hash-verified

474
475// internal
476void asCModule::UninitializeGlobalProp(asCGlobalProperty *prop)
477{
478 if (prop == 0)
479 return;
480
481 if (prop->type.IsObject())
482 {
483 void **obj = (void**)prop->GetAddressOfValue();
484 if (*obj)
485 {
486 asCObjectType *ot = CastToObjectType(prop->type.GetTypeInfo());
487
488 if (ot->flags & asOBJ_REF)
489 {
490 asASSERT((ot->flags & asOBJ_NOCOUNT) || ot->beh.release);
491 if (ot->beh.release)
492 m_engine->CallObjectMethod(*obj, ot->beh.release);
493 }
494 else
495 {
496 if (ot->beh.destruct)
497 m_engine->CallObjectMethod(*obj, ot->beh.destruct);
498
499 m_engine->CallFree(*obj);
500 }
501
502 // Set the address to 0 as someone might try to access the variable afterwards
503 *obj = 0;
504 }
505 }
506 else if (prop->type.IsFuncdef())
507 {
508 asCScriptFunction **func = (asCScriptFunction**)prop->GetAddressOfValue();
509 if (*func)
510 {
511 (*func)->Release();
512 *func = 0;
513 }
514 }
515}
516
517// internal
518void asCModule::CallExit()

Callers

nothing calls this directly

Calls 8

CastToObjectTypeFunction · 0.85
IsObjectMethod · 0.80
GetTypeInfoMethod · 0.80
CallObjectMethodMethod · 0.80
CallFreeMethod · 0.80
IsFuncdefMethod · 0.80
GetAddressOfValueMethod · 0.45
ReleaseMethod · 0.45

Tested by

no test coverage detected