Projectkk2glider/issue 4099 leaks (#4617)

* Re #4099: memory leaks on model select screen fixed [Horus]

* Re #4099: memory leak in wizard background image [Horus]
This commit is contained in:
Damjan Adamic
2017-03-14 20:09:53 +01:00
committed by Bertrand Songis
parent 0020941740
commit b965cac481
2 changed files with 19 additions and 1 deletions
+15
View File
@@ -36,6 +36,13 @@ class ModelCell
strncpy(this->modelFilename, name, sizeof(this->modelFilename));
}
~ModelCell()
{
if (buffer) {
delete buffer;
}
}
const BitmapBuffer * getBuffer()
{
if (!buffer) {
@@ -100,6 +107,14 @@ class ModelsCategory: public std::list<ModelCell *>
strncpy(this->name, name, sizeof(this->name));
}
~ModelsCategory()
{
for (std::list<ModelCell *>::iterator it = begin(); it != end(); ++it) {
delete *it;
}
}
ModelCell * addModel(const char * name)
{
ModelCell * result = new ModelCell(name);