From 22b5f0f60807c5f321a06f6e2eebca756f35c258 Mon Sep 17 00:00:00 2001 From: smix8 <52464204+smix8@users.noreply.github.com> Date: Tue, 14 Mar 2023 04:07:37 +0100 Subject: Fix GridMap free navigation RID error spam Fixes GridMap free navigation RID error spam. (cherry picked from commit cc02007e30c15f3dd3bfb0e24d0f5a90b16fe5a1) --- modules/gridmap/grid_map.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'modules') 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 &E : g.navigation_cell_ids) { - NavigationServer3D::get_singleton()->free(E.value.region); + for (KeyValue &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(); -- cgit v1.2.3