From 09248cd451cf8410bd4d25d68330efe98de3303b Mon Sep 17 00:00:00 2001 From: Powei Feng Date: Fri, 27 Jan 2023 16:05:42 -0800 Subject: [PATCH] Destroy FilamentInstance's mRoot in EntityManager (#6500) --- libs/gltfio/src/FilamentAsset.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libs/gltfio/src/FilamentAsset.cpp b/libs/gltfio/src/FilamentAsset.cpp index acec38ccdf..99b3c36a42 100644 --- a/libs/gltfio/src/FilamentAsset.cpp +++ b/libs/gltfio/src/FilamentAsset.cpp @@ -38,8 +38,10 @@ FFilamentAsset::~FFilamentAsset() { releaseSourceData(); // Destroy all instance objects. Instance entities / components are - // destroyed later in this method because they are owned by the asset. + // destroyed later in this method because they are owned by the asset + // (except for the root of the instance). for (FFilamentInstance* instance : mInstances) { + mEntityManager->destroy(instance->mRoot); delete instance; }