From: Jose Luis Blanco Claraco <joseluisblancoc@gmail.com>
Date: Sun, 9 Nov 2025 22:42:12 +0100
Subject: fix-segfault-opengl-memory-corruption

===================================================================
---
 libs/maps/CMakeLists.txt | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/libs/maps/CMakeLists.txt b/libs/maps/CMakeLists.txt
index eaf5f9b..32246ae 100644
--- a/libs/maps/CMakeLists.txt
+++ b/libs/maps/CMakeLists.txt
@@ -27,6 +27,15 @@ define_mrpt_lib(
 	)
 
 if(BUILD_mrpt-maps)
+        # Workaround to Debian bug https://bugs.debian.org/1115155
+        # Apparently caused by memory corruption in the vtable of these classes,
+        # but neither sanitizers, nor valgrind detect anything wrong.
+        set_source_files_properties(
+            src/opengl/CPlanarLaserScan.cpp
+            src/opengl/CAngularObservationMesh.cpp
+            PROPERTIES COMPILE_OPTIONS "-O1"
+        )
+
 	if(CMAKE_MRPT_HAS_LIBLAS)
 		target_link_libraries(maps PRIVATE ${LAS_LIBS})
 	endif()
