diff --git a/src/g_shared/hudmessages.cpp b/src/g_shared/hudmessages.cpp index caa041d4c6..722fb353df 100644 --- a/src/g_shared/hudmessages.cpp +++ b/src/g_shared/hudmessages.cpp @@ -150,7 +150,7 @@ DHUDMessage::DHUDMessage (FFont *font, const char *text, float x, float y, int h // //============================================================================ -DHUDMessage::~DHUDMessage () +void DHUDMessage::OnDestroy() { if (Lines) { @@ -164,6 +164,7 @@ DHUDMessage::~DHUDMessage () if (SourceText != NULL) { delete[] SourceText; + SourceText = nullptr; } } diff --git a/src/g_statusbar/sbar.h b/src/g_statusbar/sbar.h index e4ca894ace..42b164e2bd 100644 --- a/src/g_statusbar/sbar.h +++ b/src/g_statusbar/sbar.h @@ -66,7 +66,7 @@ class DHUDMessage : public DObject public: DHUDMessage (FFont *font, const char *text, float x, float y, int hudwidth, int hudheight, EColorRange textColor, float holdTime); - virtual ~DHUDMessage (); + virtual void OnDestroy () override; virtual void Serialize(FSerializer &arc);