summaryrefslogtreecommitdiff
path: root/modules/gridmap
diff options
context:
space:
mode:
authorsmix8 <52464204+smix8@users.noreply.github.com>2023-03-14 04:07:37 +0100
committerYuri Sizov <yuris@humnom.net>2023-03-27 17:27:27 +0200
commit22b5f0f60807c5f321a06f6e2eebca756f35c258 (patch)
tree08fbadcd2be939e9e50fdcc6c238574dfa47b237 /modules/gridmap
parente99b184b6c9882dd2ae578b11c7a2673b5e0f511 (diff)
Fix GridMap free navigation RID error spam
Fixes GridMap free navigation RID error spam. (cherry picked from commit cc02007e30c15f3dd3bfb0e24d0f5a90b16fe5a1)
Diffstat (limited to 'modules/gridmap')
-rw-r--r--modules/gridmap/grid_map.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/modules/gridmap/grid_map.cpp b/modules/gridmap/grid_map.cpp
index 3c0bd56e86..db8c645558 100644
--- a/modules/gridmap/grid_map.cpp
+++ b/modules/gridmap/grid_map.cpp
@@ -557,10 +557,14 @@ bool GridMap::_octant_update(const OctantKey &p_key) {
}
//erase navigation
- for (const KeyValue<IndexKey, Octant::NavigationCell> &E : g.navigation_cell_ids) {
- NavigationServer3D::get_singleton()->free(E.value.region);
+ for (KeyValue<IndexKey, Octant::NavigationCell> &E : g.navigation_cell_ids) {
+ 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()) {
RS::get_singleton()->free(E.value.navigation_mesh_debug_instance);
+ E.value.navigation_mesh_debug_instance = RID();
}
}
g.navigation_cell_ids.clear();