Fix heap-use-after-free when removing a tile in TileSet editor
This commit is contained in:
parent
55dae30177
commit
4a50f44cd2
|
@ -543,11 +543,13 @@ void TileSetAtlasSourceEditor::_update_source_inspector() {
|
||||||
|
|
||||||
void TileSetAtlasSourceEditor::_update_fix_selected_and_hovered_tiles() {
|
void TileSetAtlasSourceEditor::_update_fix_selected_and_hovered_tiles() {
|
||||||
// Fix selected.
|
// 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();
|
TileSelection selected = E->get();
|
||||||
if (!tile_set_atlas_source->has_tile(selected.tile) || !tile_set_atlas_source->has_alternative_tile(selected.tile, selected.alternative)) {
|
if (!tile_set_atlas_source->has_tile(selected.tile) || !tile_set_atlas_source->has_alternative_tile(selected.tile, selected.alternative)) {
|
||||||
selection.erase(E);
|
selection.erase(E);
|
||||||
}
|
}
|
||||||
|
E = N;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fix hovered.
|
// Fix hovered.
|
||||||
|
|
Loading…
Reference in New Issue