mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-14 08:30:49 +00:00
- fixed memory leak with texture creation.
This commit is contained in:
parent
fc5dd17d77
commit
1e844336b9
2 changed files with 25 additions and 2 deletions
|
@ -335,7 +335,7 @@ bool FHardwareTexture::BindOrCreate(FTexture *tex, int texunit, int clampmode, i
|
||||||
|
|
||||||
if (!tex->isHardwareCanvas())
|
if (!tex->isHardwareCanvas())
|
||||||
{
|
{
|
||||||
texbuffer = tex->CreateTexBuffer(translation, flags | CTF_ProcessData);
|
texbuffer = std::move(tex->CreateTexBuffer(translation, flags | CTF_ProcessData));
|
||||||
w = texbuffer.mWidth;
|
w = texbuffer.mWidth;
|
||||||
h = texbuffer.mHeight;
|
h = texbuffer.mHeight;
|
||||||
}
|
}
|
||||||
|
|
|
@ -247,10 +247,33 @@ struct FTextureBuffer
|
||||||
int mHeight = 0;
|
int mHeight = 0;
|
||||||
uint64_t mContentId = 0; // unique content identifier. (Two images created from the same image source with the same settings will return the same value.)
|
uint64_t mContentId = 0; // unique content identifier. (Two images created from the same image source with the same settings will return the same value.)
|
||||||
|
|
||||||
FTextureBuffer()
|
FTextureBuffer() = default;
|
||||||
|
|
||||||
|
~FTextureBuffer()
|
||||||
{
|
{
|
||||||
if (mBuffer) delete[] mBuffer;
|
if (mBuffer) delete[] mBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FTextureBuffer(const FTextureBuffer &other) = delete;
|
||||||
|
FTextureBuffer(FTextureBuffer &&other)
|
||||||
|
{
|
||||||
|
mBuffer = other.mBuffer;
|
||||||
|
mWidth = other.mWidth;
|
||||||
|
mHeight = other.mHeight;
|
||||||
|
mContentId = other.mContentId;
|
||||||
|
other.mBuffer = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
FTextureBuffer& operator=(FTextureBuffer &&other)
|
||||||
|
{
|
||||||
|
mBuffer = other.mBuffer;
|
||||||
|
mWidth = other.mWidth;
|
||||||
|
mHeight = other.mHeight;
|
||||||
|
mContentId = other.mContentId;
|
||||||
|
other.mBuffer = nullptr;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Base texture class
|
// Base texture class
|
||||||
|
|
Loading…
Reference in a new issue