mirror of
https://github.com/dborth/fceugx.git
synced 2025-01-07 14:28:18 +01:00
fix memory leak
This commit is contained in:
parent
c3905654a1
commit
3fb216ab3c
@ -87,9 +87,9 @@ GuiText::~GuiText()
|
|||||||
if(origText)
|
if(origText)
|
||||||
free(origText);
|
free(origText);
|
||||||
if(text)
|
if(text)
|
||||||
delete text;
|
delete[] text;
|
||||||
if(textDyn)
|
if(textDyn)
|
||||||
delete textDyn;
|
delete[] textDyn;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GuiText::SetText(const char * t)
|
void GuiText::SetText(const char * t)
|
||||||
@ -97,9 +97,9 @@ void GuiText::SetText(const char * t)
|
|||||||
if(origText)
|
if(origText)
|
||||||
free(origText);
|
free(origText);
|
||||||
if(text)
|
if(text)
|
||||||
delete text;
|
delete[] text;
|
||||||
if(textDyn)
|
if(textDyn)
|
||||||
delete textDyn;
|
delete[] textDyn;
|
||||||
|
|
||||||
origText = NULL;
|
origText = NULL;
|
||||||
text = NULL;
|
text = NULL;
|
||||||
@ -147,7 +147,7 @@ void GuiText::SetScroll(int s)
|
|||||||
|
|
||||||
if(textDyn)
|
if(textDyn)
|
||||||
{
|
{
|
||||||
delete(textDyn);
|
delete[] textDyn;
|
||||||
textDyn = NULL;
|
textDyn = NULL;
|
||||||
}
|
}
|
||||||
textScroll = s;
|
textScroll = s;
|
||||||
@ -269,7 +269,7 @@ void GuiText::Draw()
|
|||||||
tmpText[dynlen+1] = ' ';
|
tmpText[dynlen+1] = ' ';
|
||||||
strncat(&tmpText[dynlen+2], origText, maxChar - dynlen - 2);
|
strncat(&tmpText[dynlen+2], origText, maxChar - dynlen - 2);
|
||||||
}
|
}
|
||||||
if(textDyn) delete textDyn;
|
if(textDyn) delete[] textDyn;
|
||||||
textDyn = charToWideChar(tmpText);
|
textDyn = charToWideChar(tmpText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -331,7 +331,7 @@ void GuiText::Draw()
|
|||||||
for(i=0; i < linenum; i++)
|
for(i=0; i < linenum; i++)
|
||||||
{
|
{
|
||||||
fontSystem[currentSize]->drawText(this->GetLeft(), this->GetTop()+voffset+i*lineheight, textrow[i], c, style);
|
fontSystem[currentSize]->drawText(this->GetLeft(), this->GetTop()+voffset+i*lineheight, textrow[i], c, style);
|
||||||
delete textrow[i];
|
delete[] textrow[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user