| 581 | } |
| 582 | |
| 583 | void DeleteCollection(Collection* collection) |
| 584 | { |
| 585 | DM_PROFILE("DeleteCollection"); |
| 586 | |
| 587 | // We mark the collection as beeing deleted here to avoid component |
| 588 | // triggered recursive deletes to add gameobjects to the delayed delete list. |
| 589 | // |
| 590 | // For example, deleting a Spine component would mark bone gameobjects |
| 591 | // to be deleted next frame. However, since DoDeleteAll just deletes all |
| 592 | // instances directly, the entries in the "delayed delete list" might already |
| 593 | // have been deleted, making it impossible to add the spine bones to this list. |
| 594 | collection->m_ToBeDeleted = 1; |
| 595 | |
| 596 | FinalCollection(collection); |
| 597 | DoDeleteAll(collection); |
| 598 | ReleaseDynamicResources(collection); |
| 599 | |
| 600 | HCollection hcollection = collection->m_HCollection; |
| 601 | DetachCollection(collection); |
| 602 | DeallocCollection(collection); |
| 603 | delete hcollection; |
| 604 | } |
| 605 | |
| 606 | // Really should be renamed "DelayDelete" |
| 607 | void DeleteCollection(HCollection hcollection) |