From 952f0a53c995e74dc5c587551523b9ac16122c27 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Thu, 11 Nov 2021 19:06:25 +0100 Subject: [PATCH] Try to fix a leak --- code/AssetLib/X3D/X3DImporter_Geometry3D.cpp | 3 ++- code/AssetLib/X3D/X3DImporter_Node.hpp | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/code/AssetLib/X3D/X3DImporter_Geometry3D.cpp b/code/AssetLib/X3D/X3DImporter_Geometry3D.cpp index edde34281..2db62dc64 100644 --- a/code/AssetLib/X3D/X3DImporter_Geometry3D.cpp +++ b/code/AssetLib/X3D/X3DImporter_Geometry3D.cpp @@ -897,7 +897,8 @@ void X3DImporter::readSphere(XmlNode &node) { StandardShapes::MakeSphere(tess, tlist); // copy data from temp array and apply scale for (std::vector::iterator it = tlist.begin(); it != tlist.end(); ++it) { - ((X3DNodeElementGeometry3D *)ne)->Vertices.push_back(*it * radius); + aiVector3D v = *it; + ((X3DNodeElementGeometry3D *)ne)->Vertices.emplace_back(v * radius); } ((X3DNodeElementGeometry3D *)ne)->Solid = solid; diff --git a/code/AssetLib/X3D/X3DImporter_Node.hpp b/code/AssetLib/X3D/X3DImporter_Node.hpp index 95b8735d4..8d33c4b7a 100644 --- a/code/AssetLib/X3D/X3DImporter_Node.hpp +++ b/code/AssetLib/X3D/X3DImporter_Node.hpp @@ -108,6 +108,10 @@ struct X3DNodeElementBase { std::list Children; X3DElemType Type; + virtual ~X3DNodeElementBase() { + // empty + } + protected: X3DNodeElementBase(X3DElemType type, X3DNodeElementBase *pParent) : Parent(pParent), Type(type) {