summaryrefslogtreecommitdiff
path: root/editor/plugins
diff options
context:
space:
mode:
authorHaoyu Qiu <timothyqiu32@gmail.com>2022-12-04 16:52:26 +0800
committerHaoyu Qiu <timothyqiu32@gmail.com>2022-12-04 16:52:26 +0800
commit480d9d10edead569820094db079fc1bc5fbe40ca (patch)
treecb84e71880a8cf0678194f613af8b06f44bee7af /editor/plugins
parent015dc492de33a41eaeb14c0503a6be10466fe457 (diff)
Fix heap-use-after-free when exiting editor after editing TileSet
Diffstat (limited to 'editor/plugins')
-rw-r--r--editor/plugins/tiles/tile_set_atlas_source_editor.cpp9
1 files changed, 9 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 ae7570e161..7ed84423bc 100644
--- a/editor/plugins/tiles/tile_set_atlas_source_editor.cpp
+++ b/editor/plugins/tiles/tile_set_atlas_source_editor.cpp
@@ -2345,6 +2345,15 @@ void TileSetAtlasSourceEditor::_notification(int p_what) {
tile_set_changed_needs_update = false;
}
} break;
+
+ case NOTIFICATION_EXIT_TREE: {
+ for (KeyValue<String, TileDataEditor *> &E : tile_data_editors) {
+ Control *toolbar = E.value->get_toolbar();
+ if (toolbar->get_parent() == tool_settings_tile_data_toolbar_container) {
+ tool_settings_tile_data_toolbar_container->remove_child(toolbar);
+ }
+ }
+ } break;
}
}