mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-12-04 04:52:54 -05:00
Realm::define_host_classes registered each class, and defined its global constructor, before it checked the next one. A batch whose second class named an unknown parent or a member twice failed with the first class already installed, so a retry failed with "defined twice". A failed instance did the same, and could leave an object scripts held with a class the realm no longer had. Every class's name, parent and members are now checked before any class is added, so a child must still follow its parent in the batch. A failure after that point removes the classes added, puts back each global the call replaced and the class of each object an instance moved to a new class. The replaced globals stay rooted until the call ends, so a collection during the call does not free them.