Add alot of memory leak fixes

This commit is contained in:
Bram Verhulst
2024-04-23 11:17:17 +02:00
parent e75b80eea8
commit 1b90f222a4
27 changed files with 234 additions and 48 deletions

View File

@@ -1,5 +1,7 @@
#include "pch.h"
#include "TextureManager.h"
#include <iostream>
TextureManager* TextureManager::m_pInstance = nullptr;
TextureManager * TextureManager::GetInstance() {
@@ -8,6 +10,9 @@ TextureManager * TextureManager::GetInstance() {
}
return m_pInstance;
}
void TextureManager::DestroyInstance() {
delete m_pInstance;
}
Texture * TextureManager::GetTexture(const std::string& name) {
if (m_Textures.find(name) != m_Textures.end()) {
return m_Textures[name];
@@ -18,7 +23,7 @@ Texture * TextureManager::GetTexture(const std::string& name) {
}
TextureManager::~TextureManager() {
//TODO: Loop over the m_Textures to delete them
for ( const auto &p : m_Textures ) {
for (const auto& p : m_Textures) {
delete p.second;
}
}
}