Browse Source

Ensure that mesh instance is properly freed when freeing Polygon2D

clayjohn 2 years ago
parent
commit
5c95288a6e
1 changed files with 2 additions and 0 deletions
  1. 2 0
      scene/2d/polygon_2d.cpp

+ 2 - 0
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);
 }