mirror of
https://github.com/HowestDAE/dae16-VerhulstBram.git
synced 2025-12-17 07:11:48 +01:00
Add alot of memory leak fixes
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user