_dest may be destructed twice if _dest is not null in MergeScenes()

pull/3540/head
wasd845 2020-12-14 19:16:29 +08:00 committed by GitHub
parent 3d49d06bcc
commit 4e9176d2cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -183,9 +183,10 @@ void SceneCombiner::MergeScenes(aiScene **_dest, std::vector<aiScene *> &src, un
*_dest = src[0]; *_dest = src[0];
return; return;
} }
if (*_dest) if (*_dest) {
(*_dest)->~aiScene(); (*_dest)->~aiScene();
else new (*_dest) aiScene();
} else
*_dest = new aiScene(); *_dest = new aiScene();
// Create a dummy scene to serve as master for the others // Create a dummy scene to serve as master for the others