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

Method AddRef

sdk/angelscript/source/as_scriptobject.cpp:586–605  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

584}
585
586int asCScriptObject::AddRef() const
587{
588 // Warn in case the application tries to increase the refCount after it has reached zero.
589 // This may happen for example if the application calls a method on the class while it is
590 // being destroyed. The application shouldn't do this because it may cause application
591 // crashes if members that have already been destroyed are accessed accidentally.
592 if( hasRefCountReachedZero )
593 {
594 if( objType && objType->engine )
595 {
596 asCString msg;
597 msg.Format(TXT_RESURRECTING_SCRIPTOBJECT_s, objType->name.AddressOf());
598 objType->engine->WriteMessage("", 0, 0, asMSGTYPE_ERROR, msg.AddressOf());
599 }
600 }
601
602 // Increase counter and clear flag set by GC
603 gcFlag = false;
604 return refCount.atomicInc();
605}
606
607int asCScriptObject::Release() const
608{

Callers 5

ScriptObjectCopyFactoryFunction · 0.45
asCScriptObjectMethod · 0.45
CopyFromAsMethod · 0.45

Calls 4

WriteMessageMethod · 0.80
atomicIncMethod · 0.80
FormatMethod · 0.45
AddressOfMethod · 0.45

Tested by

no test coverage detected