diff --git a/src/common/2d/v_2ddrawer.cpp b/src/common/2d/v_2ddrawer.cpp index 2d1387f02..44865797b 100644 --- a/src/common/2d/v_2ddrawer.cpp +++ b/src/common/2d/v_2ddrawer.cpp @@ -528,8 +528,13 @@ void F2DDrawer::AddTexture(FGameTexture* img, DrawParms& parms) offset = osave; } -DShape2D::~DShape2D() { - delete lastParms; +void DShape2D::OnDestroy() { + if (lastParms) delete lastParms; + lastParms = nullptr; + mIndices.Reset(); + mVertices.Reset(); + mCoords.Reset(); + buffers.Reset(); } //========================================================================== diff --git a/src/common/2d/v_2ddrawer.h b/src/common/2d/v_2ddrawer.h index feac2e4d7..8bb113905 100644 --- a/src/common/2d/v_2ddrawer.h +++ b/src/common/2d/v_2ddrawer.h @@ -269,7 +269,7 @@ public: bool uploadedOnce = false; DrawParms* lastParms; - ~DShape2D(); + void OnDestroy() override; };