From 48fb43035cdece5629db4966153144ab35467b4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gilles=20Roudi=C3=A8re?= Date: Wed, 13 Oct 2021 12:12:25 +0200 Subject: Fix TileMap memory leak --- scene/2d/tile_map.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'scene/2d/tile_map.cpp') diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp index 222ec986b0..a98312f059 100644 --- a/scene/2d/tile_map.cpp +++ b/scene/2d/tile_map.cpp @@ -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(); } } -- cgit v1.2.3