Fix TileMap memory leak

This commit is contained in:
Gilles Roudière 2021-10-13 12:12:25 +02:00
parent e4288bf728
commit 48fb43035c

View file

@ -798,8 +798,9 @@ void TileMap::_rendering_cleanup_layer(int p_layer) {
ERR_FAIL_INDEX(p_layer, (int)layers.size());
RenderingServer *rs = RenderingServer::get_singleton();
if (!layers[p_layer].canvas_item.is_valid()) {
if (layers[p_layer].canvas_item.is_valid()) {
rs->free(layers[p_layer].canvas_item);
layers[p_layer].canvas_item = RID();
}
}