Merge pull request #3202 from assimp/issue_3190
closes https://github.com/assimp/assimp/issues/3190 : fix leak.pull/3204/head^2
commit
3a84675c2b
|
@ -787,8 +787,10 @@ void X3DImporter::Postprocess_CollectMetadata(const CX3DImporter_NodeElement& pN
|
||||||
// Add an element according to its type.
|
// Add an element according to its type.
|
||||||
if((*it)->Type == CX3DImporter_NodeElement::ENET_MetaBoolean)
|
if((*it)->Type == CX3DImporter_NodeElement::ENET_MetaBoolean)
|
||||||
{
|
{
|
||||||
if(((CX3DImporter_NodeElement_MetaBoolean*)cur_meta)->Value.size() > 0)
|
if(((CX3DImporter_NodeElement_MetaBoolean*)cur_meta)->Value.size() > 0) {
|
||||||
pSceneNode.mMetaData->Set(static_cast<unsigned int>(meta_idx), cur_meta->Name, *(((CX3DImporter_NodeElement_MetaBoolean*)cur_meta)->Value.begin()));
|
const bool v = (bool) *( ( (CX3DImporter_NodeElement_MetaBoolean*) cur_meta )->Value.begin());
|
||||||
|
pSceneNode.mMetaData->Set(static_cast<unsigned int>(meta_idx), cur_meta->Name, v);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if((*it)->Type == CX3DImporter_NodeElement::ENET_MetaDouble)
|
else if((*it)->Type == CX3DImporter_NodeElement::ENET_MetaDouble)
|
||||||
{
|
{
|
||||||
|
|
|
@ -86,6 +86,14 @@ typedef enum aiMetadataType {
|
||||||
struct aiMetadataEntry {
|
struct aiMetadataEntry {
|
||||||
aiMetadataType mType;
|
aiMetadataType mType;
|
||||||
void *mData;
|
void *mData;
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
aiMetadataEntry() :
|
||||||
|
mType(AI_META_MAX),
|
||||||
|
mData( nullptr ) {
|
||||||
|
// empty
|
||||||
|
}
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -313,8 +321,13 @@ struct aiMetadata {
|
||||||
|
|
||||||
// Set metadata type
|
// Set metadata type
|
||||||
mValues[index].mType = GetAiType(value);
|
mValues[index].mType = GetAiType(value);
|
||||||
|
|
||||||
// Copy the given value to the dynamic storage
|
// Copy the given value to the dynamic storage
|
||||||
mValues[index].mData = new T(value);
|
if (nullptr != mValues[index].mData) {
|
||||||
|
::memcpy(mValues[index].mData, &value, sizeof(T));
|
||||||
|
} else {
|
||||||
|
mValues[index].mData = new T(value);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue