Merge pull request #74891 from jmattspartacus/OccluderPolygon2D_memLeak_53722
Fix for OccluderPolygon2D memory leak
This commit is contained in:
commit
08c1b55862
1 changed files with 3 additions and 2 deletions
|
@ -1866,7 +1866,7 @@ void RendererCanvasRenderRD::occluder_polygon_set_shape(RID p_occluder, const Ve
|
|||
}
|
||||
}
|
||||
|
||||
if (oc->line_point_count != lines.size() && oc->vertex_array.is_valid()) {
|
||||
if ((oc->line_point_count != lines.size() || lines.size() == 0) && oc->vertex_array.is_valid()) {
|
||||
RD::get_singleton()->free(oc->vertex_array);
|
||||
RD::get_singleton()->free(oc->vertex_buffer);
|
||||
RD::get_singleton()->free(oc->index_array);
|
||||
|
@ -1881,6 +1881,7 @@ void RendererCanvasRenderRD::occluder_polygon_set_shape(RID p_occluder, const Ve
|
|||
}
|
||||
|
||||
if (lines.size()) {
|
||||
oc->line_point_count = lines.size();
|
||||
Vector<uint8_t> geometry;
|
||||
Vector<uint8_t> indices;
|
||||
int lc = lines.size();
|
||||
|
@ -1971,7 +1972,7 @@ void RendererCanvasRenderRD::occluder_polygon_set_shape(RID p_occluder, const Ve
|
|||
}
|
||||
}
|
||||
|
||||
if (oc->sdf_index_count != sdf_indices.size() && oc->sdf_point_count != p_points.size() && oc->sdf_vertex_array.is_valid()) {
|
||||
if (((oc->sdf_index_count != sdf_indices.size() && oc->sdf_point_count != p_points.size()) || p_points.size() == 0) && oc->sdf_vertex_array.is_valid()) {
|
||||
RD::get_singleton()->free(oc->sdf_vertex_array);
|
||||
RD::get_singleton()->free(oc->sdf_vertex_buffer);
|
||||
RD::get_singleton()->free(oc->sdf_index_array);
|
||||
|
|
Loading…
Reference in a new issue