A memory leak a day keeps the doc away
This commit is contained in:
parent
da0ff9ab04
commit
f87bcfd3a2
2 changed files with 5 additions and 4 deletions
|
|
@ -42,7 +42,7 @@
|
|||
#include "palettecontainer.h"
|
||||
|
||||
FMemArena ImageArena(32768);
|
||||
TArray<FImageSource *>FImageSource::ImageForLump;
|
||||
TArray<std::unique_ptr<FImageSource>>FImageSource::ImageForLump;
|
||||
int FImageSource::NextID;
|
||||
static PrecacheInfo precacheInfo;
|
||||
|
||||
|
|
@ -373,7 +373,7 @@ FImageSource * FImageSource::GetImage(int lumpnum, bool isflat)
|
|||
for (; size < ImageForLump.Size(); size++) ImageForLump[size] = nullptr;
|
||||
}
|
||||
// An image for this lump already exists. We do not need another one.
|
||||
if (ImageForLump[lumpnum] != nullptr) return ImageForLump[lumpnum];
|
||||
if (ImageForLump[lumpnum] != nullptr) return ImageForLump[lumpnum].get();
|
||||
|
||||
auto data = fileSystem.OpenFileReader(lumpnum);
|
||||
if (!data.isOpen())
|
||||
|
|
@ -386,7 +386,7 @@ FImageSource * FImageSource::GetImage(int lumpnum, bool isflat)
|
|||
auto image = CreateInfo[i].TryCreate(data, lumpnum);
|
||||
if (image != nullptr)
|
||||
{
|
||||
ImageForLump[lumpnum] = image;
|
||||
ImageForLump[lumpnum].reset(image);
|
||||
return image;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <memory>
|
||||
#include "tarray.h"
|
||||
#include "bitmap.h"
|
||||
#include "memarena.h"
|
||||
|
|
@ -63,7 +64,7 @@ class FImageSource
|
|||
friend class FBrightmapTexture;
|
||||
protected:
|
||||
|
||||
static TArray<FImageSource *>ImageForLump;
|
||||
static TArray<std::unique_ptr<FImageSource>> ImageForLump;
|
||||
static int NextID;
|
||||
|
||||
int SourceLump;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue