summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorclayjohn <claynjohn@gmail.com>2022-11-24 17:34:25 -0800
committerclayjohn <claynjohn@gmail.com>2022-11-24 17:34:25 -0800
commit5c95288a6e6cacdd62f1698b00157de4d56fdfc9 (patch)
tree24441b886f09b363e9ad4dec3d388a408f6242e7
parent7580565c28e7e10db7f551287e1f91cfd614b195 (diff)
Ensure that mesh instance is properly freed when freeing Polygon2D
-rw-r--r--scene/2d/polygon_2d.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/scene/2d/polygon_2d.cpp b/scene/2d/polygon_2d.cpp
index 2c825e8f7b..e41664b006 100644
--- a/scene/2d/polygon_2d.cpp
+++ b/scene/2d/polygon_2d.cpp
@@ -663,5 +663,7 @@ Polygon2D::Polygon2D() {
}
Polygon2D::~Polygon2D() {
+ // This will free the internally-allocated mesh instance, if allocated.
+ RS::get_singleton()->canvas_item_attach_skeleton(get_canvas_item(), RID());
RS::get_singleton()->free(mesh);
}