fix for shape registration

The automatic global static was hitting a destructor on xcode, this seemed like it was being pedantic about name at first but then between runs the same issue would come back. With this change it is wrapped in a function to get the vector instead.
This commit is contained in:
marauder2k7 2026-06-07 22:10:52 +01:00
parent 0c2aa5328c
commit e83bab90d7
4 changed files with 23 additions and 14 deletions

View file

@ -38,19 +38,28 @@
#include "core/stream/fileStream.h"
#include "core/fileObject.h"
Vector<TSShape::ShapeRegistration> TSShape::sRegistrations(__FILE__, __LINE__);
// Vector<TSShape::ShapeRegistration> TSShape::sShapeRegistrations(__FILE__, __LINE__);
Vector<TSShape::ShapeRegistration>& TSShape::getShapeRegistrations()
{
static Vector<TSShape::ShapeRegistration>* regs =
new Vector<TSShape::ShapeRegistration>(__FILE__, __LINE__);
return *regs;
}
void TSShape::sRegisterFormat(const ShapeRegistration& reg)
{
U32 insert = sRegistrations.size();
sRegistrations.insert(insert, reg);
U32 insert = getShapeRegistrations().size();
getShapeRegistrations().insert(insert, reg);
}
const TSShape::ShapeRegistration* TSShape::sFindRegInfo(const String& extension, bool exporting)
const TSShape::ShapeRegistration* TSShape::sFindShapeRegInfo(const String& extension, bool exporting)
{
for (U32 i = 0; i < TSShape::sRegistrations.size(); i++)
for (U32 i = 0; i < getShapeRegistrations().size(); i++)
{
const TSShape::ShapeRegistration& reg = TSShape::sRegistrations[i];
const TSShape::ShapeRegistration& reg = getShapeRegistrations()[i];
const Vector<ShapeFormat>& extensions = exporting ? reg.export_extensions : reg.extensions;
for (U32 j = 0; j < extensions.size(); j++)
@ -2358,7 +2367,7 @@ template<> void *Resource<TSShape>::create(const Torque::Path &path)
}
else
{
const TSShape::ShapeRegistration* regInfo = TSShape::sFindRegInfo(extension);
const TSShape::ShapeRegistration* regInfo = TSShape::sFindShapeRegInfo(extension);
if (regInfo == NULL)
{
readSuccess = false;