Merge pull request #74889 from smix8/gridmap_navrid_error_spam_4.x

Fix GridMap free navigation RID error spam
This commit is contained in:
Yuri Sizov 2023-03-21 14:35:54 +01:00 committed by GitHub
commit e76c7122b8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -557,10 +557,14 @@ bool GridMap::_octant_update(const OctantKey &p_key) {
} }
//erase navigation //erase navigation
for (const KeyValue<IndexKey, Octant::NavigationCell> &E : g.navigation_cell_ids) { for (KeyValue<IndexKey, Octant::NavigationCell> &E : g.navigation_cell_ids) {
NavigationServer3D::get_singleton()->free(E.value.region); if (E.value.region.is_valid()) {
NavigationServer3D::get_singleton()->free(E.value.region);
E.value.region = RID();
}
if (E.value.navigation_mesh_debug_instance.is_valid()) { if (E.value.navigation_mesh_debug_instance.is_valid()) {
RS::get_singleton()->free(E.value.navigation_mesh_debug_instance); RS::get_singleton()->free(E.value.navigation_mesh_debug_instance);
E.value.navigation_mesh_debug_instance = RID();
} }
} }
g.navigation_cell_ids.clear(); g.navigation_cell_ids.clear();