| 584 | } |
| 585 | |
| 586 | int 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 | |
| 607 | int asCScriptObject::Release() const |
| 608 | { |
no test coverage detected