mirror of
https://github.com/godotengine/godot.git
synced 2025-03-01 23:21:39 +08:00
Fix heap-use-after-free when using TileMap editor
This commit is contained in:
parent
0daa86d70e
commit
1ac35c38be
@ -1488,13 +1488,15 @@ void TileMapEditorTilesPlugin::_update_fix_selected_and_hovered() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Selection if needed.
|
// Selection if needed.
|
||||||
for (RBSet<TileMapCell>::Element *E = tile_set_selection.front(); E; E = E->next()) {
|
for (RBSet<TileMapCell>::Element *E = tile_set_selection.front(); E;) {
|
||||||
|
RBSet<TileMapCell>::Element *N = E->next();
|
||||||
const TileMapCell *selected = &(E->get());
|
const TileMapCell *selected = &(E->get());
|
||||||
if (!tile_set->has_source(selected->source_id) ||
|
if (!tile_set->has_source(selected->source_id) ||
|
||||||
!tile_set->get_source(selected->source_id)->has_tile(selected->get_atlas_coords()) ||
|
!tile_set->get_source(selected->source_id)->has_tile(selected->get_atlas_coords()) ||
|
||||||
!tile_set->get_source(selected->source_id)->has_alternative_tile(selected->get_atlas_coords(), selected->alternative_tile)) {
|
!tile_set->get_source(selected->source_id)->has_alternative_tile(selected->get_atlas_coords(), selected->alternative_tile)) {
|
||||||
tile_set_selection.erase(E);
|
tile_set_selection.erase(E);
|
||||||
}
|
}
|
||||||
|
E = N;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!tile_map_selection.is_empty()) {
|
if (!tile_map_selection.is_empty()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user