From c642d9f25ed3f894340f513135f5b71bd7bbf106 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Sun, 1 Nov 2015 15:15:39 +0100 Subject: [PATCH] Collada exporter: fix access violation. --- test/unit/utColladaExportCamera.cpp | 2 +- test/unit/utColladaExportLight.cpp | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/test/unit/utColladaExportCamera.cpp b/test/unit/utColladaExportCamera.cpp index ea9afe15c..41a4dce3a 100644 --- a/test/unit/utColladaExportCamera.cpp +++ b/test/unit/utColladaExportCamera.cpp @@ -71,7 +71,6 @@ TEST_F(ColladaExportCamera, testExportCamera) EXPECT_EQ( origNumCams, imported->mNumCameras ); for(size_t i=0; i< imported->mNumCameras;i++){ - //const aiCamera *orig = pTest->mCameras[ i ]; const aiCamera *read = imported->mCameras[ i ]; EXPECT_TRUE( names[ i ] == read->mName ); @@ -83,6 +82,7 @@ TEST_F(ColladaExportCamera, testExportCamera) EXPECT_FLOAT_EQ( pos[ i ].y,read->mPosition.y); EXPECT_FLOAT_EQ( pos[ i ].z,read->mPosition.z); } + delete [] origFOV; delete [] orifClipPlaneNear; delete [] orifClipPlaneFar; diff --git a/test/unit/utColladaExportLight.cpp b/test/unit/utColladaExportLight.cpp index ee17b77e0..7c4d2edef 100644 --- a/test/unit/utColladaExportLight.cpp +++ b/test/unit/utColladaExportLight.cpp @@ -47,6 +47,11 @@ TEST_F(ColladaExportLight, testExportLight) ASSERT_TRUE(pTest!=NULL); ASSERT_TRUE(pTest->HasLights()); + const unsigned int origNumLights( pTest->mNumLights ); + aiLight *origLights = new aiLight[ origNumLights ]; + for (size_t i = 0; i < origNumLights; i++) { + origLights[ i ] = *(pTest->mLights[ i ]); + } EXPECT_EQ(AI_SUCCESS,ex->Export(pTest,"collada",file)); EXPECT_EQ(AI_SUCCESS,ex->Export(pTest,"collada","lightsExp.dae")); @@ -56,11 +61,11 @@ TEST_F(ColladaExportLight, testExportLight) ASSERT_TRUE(imported!=NULL); EXPECT_TRUE(imported->HasLights()); - EXPECT_EQ(pTest->mNumLights,imported->mNumLights); - + EXPECT_EQ( origNumLights,imported->mNumLights ); for(size_t i=0; i< pTest->mNumLights;i++){ - const aiLight *orig = pTest->mLights[i]; + const aiLight *orig = &origLights[ i ]; + const aiLight *read = imported->mLights[i]; EXPECT_TRUE(orig->mName==read->mName);