revert memory leak fix
parent
b93c360b87
commit
6f7cb6af06
|
@ -270,14 +270,13 @@ Ref<T> LazyDict<T>::Retrieve(unsigned int i)
|
||||||
throw DeadlyImportError("GLTF: Object at index \"" + to_string(i) + "\" is not a JSON object");
|
throw DeadlyImportError("GLTF: Object at index \"" + to_string(i) + "\" is not a JSON object");
|
||||||
}
|
}
|
||||||
|
|
||||||
// In case Read method throws an exception this will not leak
|
T* inst = new T();
|
||||||
auto inst = std::make_unique<T>();
|
|
||||||
inst->id = std::string(mDictId) + "_" + to_string(i);
|
inst->id = std::string(mDictId) + "_" + to_string(i);
|
||||||
inst->oIndex = i;
|
inst->oIndex = i;
|
||||||
ReadMember(obj, "name", inst->name);
|
ReadMember(obj, "name", inst->name);
|
||||||
inst->Read(obj, mAsset);
|
inst->Read(obj, mAsset);
|
||||||
|
|
||||||
return Add(inst.release());
|
return Add(inst);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
|
|
Loading…
Reference in New Issue