Track ImageAssets so we can delete them
diff --git a/include/rive/file.hpp b/include/rive/file.hpp index c7b4017..9d2ea3f 100644 --- a/include/rive/file.hpp +++ b/include/rive/file.hpp
@@ -42,6 +42,9 @@ /// where the artboards live. std::unique_ptr<Backboard> m_Backboard; + /// We just keep these alive for the life of this File + std::vector<std::unique_ptr<FileAsset>> m_FileAssets; + /// List of artboards in the file. Each artboard encapsulates a set of /// Rive components and animations. std::vector<std::unique_ptr<Artboard>> m_Artboards;
diff --git a/src/file.cpp b/src/file.cpp index a231f9c..27266a8 100644 --- a/src/file.cpp +++ b/src/file.cpp
@@ -168,6 +168,10 @@ ab->m_Factory = m_Factory; m_Artboards.push_back(std::unique_ptr<Artboard>(ab)); } break; + case ImageAsset::typeKey: { + auto fa = object->as<FileAsset>(); + m_FileAssets.push_back(std::unique_ptr<FileAsset>(fa)); + } break; } } else { fprintf(stderr, "Failed to import object of type %d\n", object->coreType());