[as3] Fixed memory leak in Triangulator

This commit is contained in:
badlogic 2017-05-04 14:16:59 +02:00
parent fdf6aba634
commit 11b402fcaf
4 changed files with 6 additions and 0 deletions

View File

@ -175,6 +175,9 @@ package spine {
if (polygon.length > 0) { if (polygon.length > 0) {
convexPolygons.push(polygon); convexPolygons.push(polygon);
convexPolygonsIndices.push(polygonIndices); convexPolygonsIndices.push(polygonIndices);
} else {
polygonPool.free(polygon);
polygonIndicesPool.free(polygonIndices);
} }
polygon = Vector.<Number>(this.polygonPool.obtain()); polygon = Vector.<Number>(this.polygonPool.obtain());
polygon.length = 0; polygon.length = 0;
@ -250,6 +253,9 @@ package spine {
if (polygon.length == 0) { if (polygon.length == 0) {
convexPolygons.splice(i, 1); convexPolygons.splice(i, 1);
this.polygonPool.free(polygon); this.polygonPool.free(polygon);
polygonIndices = convexPolygonsIndices[i];
convexPolygonsIndices.splice(i, 1);
this.polygonIndicesPool.free(polygonIndices);
} }
} }