From e7fb2f029419f548b9df80c046005933384741ad Mon Sep 17 00:00:00 2001 From: Adam Scott Date: Sun, 11 Dec 2022 13:21:10 -0500 Subject: Fix `heap-use-after-free` error in `TileMap::~TileMap()` Co-authored-by: Gilles Roudiere --- scene/2d/tile_map.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'scene') diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp index 8b27dbe3db..06ec1d6eca 100644 --- a/scene/2d/tile_map.cpp +++ b/scene/2d/tile_map.cpp @@ -4072,5 +4072,9 @@ TileMap::TileMap() { } TileMap::~TileMap() { + if (tile_set.is_valid()) { + tile_set->disconnect("changed", callable_mp(this, &TileMap::_tile_set_changed)); + } + _clear_internals(); } -- cgit v1.2.3