fixed leaks; leaking resources do not assert, they are still logged though

This commit is contained in:
Mikulas Florek 2023-08-25 14:41:08 +02:00
parent 8df1da8eda
commit fb9d87bc31
10 changed files with 7 additions and 27 deletions

View file

@ -24,7 +24,6 @@ Controller::Controller(const Path& path, ResourceManager& resource_manager, IAll
Controller::~Controller() {
LUMIX_DELETE(m_allocator, m_root);
ASSERT(isEmpty());
}
void Controller::unload() {

View file

@ -3003,6 +3003,8 @@ struct ModelPlugin final : AssetBrowser::IPlugin, AssetCompiler::IPlugin {
struct AnimationJob : TileData::Job {
Model* model = nullptr;
Animation* animation = nullptr;
~AnimationJob() { model->decRefCount(); animation->decRefCount(); }
bool prepare() override { return !animation->isEmpty() && !model->isEmpty(); }
void execute(ModelPlugin& plugin) override {
plugin.renderTile(model, animation, nullptr);
@ -3011,6 +3013,8 @@ struct ModelPlugin final : AssetBrowser::IPlugin, AssetCompiler::IPlugin {
struct MaterialJob : TileData::Job {
Material* material = nullptr;
~MaterialJob() { material->decRefCount(); }
bool prepare() override { return !material->isEmpty(); }
void execute(ModelPlugin& plugin) override {
plugin.renderTile(material);
@ -3019,6 +3023,8 @@ struct ModelPlugin final : AssetBrowser::IPlugin, AssetCompiler::IPlugin {
struct PrefabJob : TileData::Job {
PrefabResource* prefab = nullptr;
~PrefabJob() { prefab->decRefCount(); }
bool prepare() override { return !prefab->isEmpty(); }
void execute(ModelPlugin& plugin) override {
plugin.renderTile(prefab);
@ -3027,6 +3033,7 @@ struct ModelPlugin final : AssetBrowser::IPlugin, AssetCompiler::IPlugin {
struct ModelJob : TileData::Job {
Model* model = nullptr;
~ModelJob() { model->decRefCount(); }
bool prepare() override { return !model->isEmpty(); }
void execute(ModelPlugin& plugin) override {
plugin.renderTile(model, nullptr, nullptr);

View file

@ -51,12 +51,6 @@ Material::Material(const Path& path, ResourceManager& resource_manager, Renderer
}
Material::~Material()
{
ASSERT(isEmpty());
}
const char* Material::getCustomFlagName(int index)
{
return s_custom_flags.flags[index];

View file

@ -57,7 +57,6 @@ struct LUMIX_RENDERER_API Material final : Resource {
static const ResourceType TYPE;
Material(const Path& path, ResourceManager& resource_manager, Renderer& renderer, IAllocator& allocator);
~Material();
ResourceType getType() const override { return TYPE; }
Renderer& getRenderer() { return m_renderer; }

View file

@ -117,11 +117,6 @@ Model::Model(const Path& path, ResourceManager& resource_manager, Renderer& rend
}
Model::~Model()
{
ASSERT(isEmpty());
}
static Vec3 evaluateSkin(Vec3& p, Mesh::Skin s, const Matrix* matrices)
{
Matrix m = matrices[s.indices[0]] * s.weights.x + matrices[s.indices[1]] * s.weights.y +

View file

@ -160,7 +160,6 @@ public:
public:
Model(const Path& path, ResourceManager& resource_manager, Renderer& renderer, IAllocator& allocator);
~Model();
ResourceType getType() const override { return TYPE; }

View file

@ -50,11 +50,6 @@ Shader::Shader(const Path& path, ResourceManager& resource_manager, Renderer& re
}
Shader::~Shader()
{
ASSERT(isEmpty());
}
bool Shader::hasDefine(u8 define) const {
return m_defines.indexOf(define) >= 0;
}

View file

@ -95,7 +95,6 @@ struct LUMIX_RENDERER_API Shader final : Resource {
};
Shader(const Path& path, ResourceManager& resource_manager, Renderer& renderer, IAllocator& allocator);
~Shader();
ResourceType getType() const override { return TYPE; }
bool hasDefine(u8 define) const;

View file

@ -42,12 +42,6 @@ Texture::Texture(const Path& path, ResourceManager& resource_manager, Renderer&
}
Texture::~Texture()
{
ASSERT(isEmpty());
}
bool Texture::getFlag(Flags flag)
{
return flags & u32(flag);

View file

@ -82,7 +82,6 @@ struct LUMIX_RENDERER_API Texture final : Resource {
};
Texture(const Path& path, ResourceManager& resource_manager, Renderer& renderer, IAllocator& allocator);
~Texture();
ResourceType getType() const override { return TYPE; }