fixed a few memory leaks

This commit is contained in:
Christoph Oelckers 2024-10-05 10:22:05 +02:00
parent 2b2e85005c
commit f0676cdf01
6 changed files with 15 additions and 2 deletions

View file

@ -18,6 +18,8 @@ LineEdit::LineEdit(Widget* parent) : Widget(parent)
LineEdit::~LineEdit()
{
delete timer;
delete scroll_timer;
}
bool LineEdit::IsReadOnly() const

View file

@ -331,6 +331,7 @@ void PType::StaticInit()
TypeVoidPtr = NewPointer(TypeVoid, false);
TypeRawFunction = new PPointer;
TypeRawFunction->mDescriptiveName = "Raw Function Pointer";
TypeTable.AddType(TypeRawFunction, NAME_None);
TypeVMFunction = NewPointer(NewStruct("VMFunction", nullptr, true));
TypeColorStruct = NewStruct("@ColorStruct", nullptr); //This name is intentionally obfuscated so that it cannot be used explicitly. The point of this type is to gain access to the single channels of a color value.
TypeStringStruct = NewStruct("Stringstruct", nullptr, true);

View file

@ -372,6 +372,13 @@ FStartScreen* GetGameStartScreen(int max_progress)
return nullptr;
}
FStartScreen::~FStartScreen()
{
if (StartupTexture) delete StartupTexture;
if (HeaderTexture) delete HeaderTexture;
if (NetTexture) delete NetTexture;
}
//==========================================================================
//
// ST_Util_ClearBlock

View file

@ -70,7 +70,7 @@ protected:
FGameTexture* NetTexture = nullptr;
public:
FStartScreen(int maxp) { MaxPos = maxp; }
virtual ~FStartScreen() = default;
virtual ~FStartScreen();
void Render(bool force = false);
bool Progress(int);
void NetProgress(int count);

View file

@ -21,6 +21,7 @@ void InitWidgetResources(const char* filename)
void CloseWidgetResources()
{
if (WidgetResources) delete WidgetResources;
WidgetResources = nullptr;
}
static std::vector<uint8_t> LoadFile(const char* name)

View file

@ -161,6 +161,7 @@ bool M_SetSpecialMenu(FName& menu, int param); // game specific checks
const FIWADInfo *D_FindIWAD(TArray<FString> &wadfiles, const char *iwad, const char *basewad);
void InitWidgetResources(const char* basewad);
void CloseWidgetResources();
// PUBLIC FUNCTION PROTOTYPES ----------------------------------------------
@ -3844,6 +3845,7 @@ int GameMain()
M_SaveDefaultsFinal();
DeleteStartupScreen();
C_UninitCVars(); // must come last so that nothing will access the CVARs anymore after deletion.
CloseWidgetResources();
delete Args;
Args = nullptr;
return ret;