first patch of UB

This commit is contained in:
Nikita Edel
2026-03-09 21:54:43 +01:00
parent d36433cafc
commit 5265eef759
8 changed files with 30 additions and 9 deletions

View File

@@ -60,11 +60,19 @@ void StitchedTexture::freeFrameTextures()
StitchedTexture::~StitchedTexture()
{
for(AUTO_VAR(it, frames->begin()); it != frames->end(); ++it)
{
delete *it;
// 4jcraft added null check, in PreStitchedTextures::stitch(), than ::loadUVs()
// all new SimpleIcons deriving from StitchedIcons are calling the
// constructor which does frames = NULL
// so the program breaks on delete oldClock in ::loadUVs()
// but scince "frames" is never allocated (StitchedTexture::init())
// not called, frames was never called (only the constructor)
if(frames) {
for(AUTO_VAR(it, frames->begin()); it != frames->end(); ++it)
{
delete *it;
}
delete frames;
}
delete frames;
}
void StitchedTexture::initUVs(float U0, float V0, float U1, float V1)
@@ -351,4 +359,4 @@ int StitchedTexture::getFlags() const
bool StitchedTexture::hasOwnData()
{
return true;
}
}