From fa7be20ee1255c9130a7b242f7886bd88b82aca4 Mon Sep 17 00:00:00 2001 From: lawnjelly Date: Mon, 14 Aug 2023 10:25:50 +0100 Subject: [PATCH] Fix crash on exit where TileSet calls destroyed TileSetAtlasSourceEditor Removes signal from TileSet on destroying TileSetAtlasSourceEditor, to prevent TileSet calling function in destroyed TileSetAtlasSourceEditor. --- editor/plugins/tiles/tile_set_atlas_source_editor.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/editor/plugins/tiles/tile_set_atlas_source_editor.cpp b/editor/plugins/tiles/tile_set_atlas_source_editor.cpp index c98d9086d18..b1111be0063 100644 --- a/editor/plugins/tiles/tile_set_atlas_source_editor.cpp +++ b/editor/plugins/tiles/tile_set_atlas_source_editor.cpp @@ -2655,6 +2655,12 @@ TileSetAtlasSourceEditor::TileSetAtlasSourceEditor() { TileSetAtlasSourceEditor::~TileSetAtlasSourceEditor() { memdelete(tile_proxy_object); memdelete(atlas_source_proxy_object); + + // Remove listener for old objects, so the TileSet doesn't + // try to call the destroyed TileSetAtlasSourceEditor. + if (tile_set.is_valid()) { + tile_set->disconnect_changed(callable_mp(this, &TileSetAtlasSourceEditor::_tile_set_changed)); + } } ////// EditorPropertyTilePolygon //////