| 524 | } |
| 525 | |
| 526 | void JsonAsset::DeleteInstance() |
| 527 | { |
| 528 | ScopeLock lock(Locker); |
| 529 | |
| 530 | // C# instance |
| 531 | MObject* object = GetManagedInstance(); |
| 532 | MClass* klass = GetClass(); |
| 533 | if (object && klass) |
| 534 | { |
| 535 | const MField* field = klass->GetField("_instance"); |
| 536 | if (field) |
| 537 | field->SetValue(object, nullptr); |
| 538 | } |
| 539 | |
| 540 | // C++ instance |
| 541 | if (!Instance) |
| 542 | return; |
| 543 | if (_dtor) |
| 544 | { |
| 545 | _dtor(Instance); |
| 546 | _dtor = nullptr; |
| 547 | Allocator::Free(Instance); |
| 548 | } |
| 549 | else |
| 550 | { |
| 551 | Delete((ScriptingObject*)Instance); |
| 552 | } |
| 553 | InstanceType = ScriptingTypeHandle(); |
| 554 | Instance = nullptr; |
| 555 | } |
| 556 | |
| 557 | #if USE_EDITOR |
| 558 |
nothing calls this directly
no test coverage detected