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() LineEdit::~LineEdit()
{ {
delete timer;
delete scroll_timer;
} }
bool LineEdit::IsReadOnly() const bool LineEdit::IsReadOnly() const

View file

@ -331,6 +331,7 @@ void PType::StaticInit()
TypeVoidPtr = NewPointer(TypeVoid, false); TypeVoidPtr = NewPointer(TypeVoid, false);
TypeRawFunction = new PPointer; TypeRawFunction = new PPointer;
TypeRawFunction->mDescriptiveName = "Raw Function Pointer"; TypeRawFunction->mDescriptiveName = "Raw Function Pointer";
TypeTable.AddType(TypeRawFunction, NAME_None);
TypeVMFunction = NewPointer(NewStruct("VMFunction", nullptr, true)); 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. 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); TypeStringStruct = NewStruct("Stringstruct", nullptr, true);

View file

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

View file

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

View file

@ -21,6 +21,7 @@ void InitWidgetResources(const char* filename)
void CloseWidgetResources() void CloseWidgetResources()
{ {
if (WidgetResources) delete WidgetResources; if (WidgetResources) delete WidgetResources;
WidgetResources = nullptr;
} }
static std::vector<uint8_t> LoadFile(const char* name) 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); const FIWADInfo *D_FindIWAD(TArray<FString> &wadfiles, const char *iwad, const char *basewad);
void InitWidgetResources(const char* basewad); void InitWidgetResources(const char* basewad);
void CloseWidgetResources();
// PUBLIC FUNCTION PROTOTYPES ---------------------------------------------- // PUBLIC FUNCTION PROTOTYPES ----------------------------------------------
@ -3844,6 +3845,7 @@ int GameMain()
M_SaveDefaultsFinal(); M_SaveDefaultsFinal();
DeleteStartupScreen(); DeleteStartupScreen();
C_UninitCVars(); // must come last so that nothing will access the CVARs anymore after deletion. C_UninitCVars(); // must come last so that nothing will access the CVARs anymore after deletion.
CloseWidgetResources();
delete Args; delete Args;
Args = nullptr; Args = nullptr;
return ret; return ret;