summaryrefslogtreecommitdiff
path: root/scene/2d/tile_map.cpp
diff options
context:
space:
mode:
authorGilles Roudière <gilles.roudiere@gmail.com>2021-10-13 12:12:25 +0200
committerGilles Roudière <gilles.roudiere@gmail.com>2021-10-13 12:12:25 +0200
commit48fb43035cdece5629db4966153144ab35467b4d (patch)
treecdf63e9caf3115172073153db1410efd8699be77 /scene/2d/tile_map.cpp
parente4288bf7283376adc274860744203faad34d83ec (diff)
Fix TileMap memory leak
Diffstat (limited to 'scene/2d/tile_map.cpp')
-rw-r--r--scene/2d/tile_map.cpp3
1 files changed, 2 insertions, 1 deletions
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();
}
}