From 657c1d8ad0b0afba9c96cd1526d8bb2ea305a2c0 Mon Sep 17 00:00:00 2001 From: Turo Lamminen Date: Fri, 24 Feb 2023 13:44:40 +0200 Subject: [PATCH] Use unique_ptr to store pivot nodes until moved to mapPivot --- code/AssetLib/LWO/LWOLoader.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/code/AssetLib/LWO/LWOLoader.cpp b/code/AssetLib/LWO/LWOLoader.cpp index a44c1dc96..35ebc512c 100644 --- a/code/AssetLib/LWO/LWOLoader.cpp +++ b/code/AssetLib/LWO/LWOLoader.cpp @@ -574,9 +574,9 @@ void LWOImporter::GenerateNodeGraph(std::map &apcNodes) { uint16_t parentIndex = nodeLayer->mParent; //Create pivot node, store it into the pivot map, and set the parent as the pivot - aiNode *pivotNode = new aiNode(); + std::unique_ptr pivotNode(new aiNode()); pivotNode->mName.Set("Pivot-" + std::string(itapcNodes->second->mName.data)); - itapcNodes->second->mParent = pivotNode; + itapcNodes->second->mParent = pivotNode.get(); //Look for the parent node to attach the pivot to if (apcNodes.find(parentIndex) != apcNodes.end()) { @@ -593,7 +593,7 @@ void LWOImporter::GenerateNodeGraph(std::map &apcNodes) { pivotNode->mTransformation.a4 = nodeLayer->mPivot.x; pivotNode->mTransformation.b4 = nodeLayer->mPivot.y; pivotNode->mTransformation.c4 = nodeLayer->mPivot.z; - mapPivot[-(itapcNodes->first + 2)] = pivotNode; + mapPivot[-(itapcNodes->first + 2)] = pivotNode.release(); } //Merge pivot map into node map