Merge pull request #69323 from timothyqiu/erase-in-loop
Fix heap-use-after-free when removing a tile in TileSet editor
This commit is contained in:
commit
a3e39d7e7c
1 changed files with 3 additions and 1 deletions
|
@ -543,11 +543,13 @@ void TileSetAtlasSourceEditor::_update_source_inspector() {
|
|||
|
||||
void TileSetAtlasSourceEditor::_update_fix_selected_and_hovered_tiles() {
|
||||
// Fix selected.
|
||||
for (RBSet<TileSelection>::Element *E = selection.front(); E; E = E->next()) {
|
||||
for (RBSet<TileSelection>::Element *E = selection.front(); E;) {
|
||||
RBSet<TileSelection>::Element *N = E->next();
|
||||
TileSelection selected = E->get();
|
||||
if (!tile_set_atlas_source->has_tile(selected.tile) || !tile_set_atlas_source->has_alternative_tile(selected.tile, selected.alternative)) {
|
||||
selection.erase(E);
|
||||
}
|
||||
E = N;
|
||||
}
|
||||
|
||||
// Fix hovered.
|
||||
|
|
Loading…
Reference in a new issue