From cc02007e30c15f3dd3bfb0e24d0f5a90b16fe5a1 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: [PATCH] Fix GridMap free navigation RID error spam Fixes GridMap free navigation RID error spam. --- modules/gridmap/grid_map.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/gridmap/grid_map.cpp b/modules/gridmap/grid_map.cpp index 3c0bd56e865b..db8c645558f4 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();