summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-08-14 15:30:32 +0200
committerRémi Verschelde <rverschelde@gmail.com>2023-08-14 15:30:32 +0200
commitc2fde9cc1e6cf672c56f97f0badf87dae4b02c5f (patch)
tree99747a2c5a5af2d7b430d480c7c78efde8ee0bcb
parent6f1c2052210f0edb756ce71fc89665d5e8bc1168 (diff)
parentfa7be20ee1255c9130a7b242f7886bd88b82aca4 (diff)
downloadredot-engine-c2fde9cc1e6cf672c56f97f0badf87dae4b02c5f.tar.gz
Merge pull request #80607 from lawnjelly/fix_tileset_signal_crash
Fix crash on exit where `TileSet` calls destroyed `TileSetAtlasSourceEditor`
-rw-r--r--editor/plugins/tiles/tile_set_atlas_source_editor.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/editor/plugins/tiles/tile_set_atlas_source_editor.cpp b/editor/plugins/tiles/tile_set_atlas_source_editor.cpp
index c98d9086d1..b1111be006 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 //////