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

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

diff --git a/libs/opengl/CMakeLists.txt b/libs/opengl/CMakeLists.txt
index af09bf0..0f0b653 100644
--- a/libs/opengl/CMakeLists.txt
+++ b/libs/opengl/CMakeLists.txt
@@ -43,6 +43,15 @@ if(NOT BUILD_mrpt-opengl)
   return()
 endif()
 
+# 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/CRenderizableShaderTriangles.cpp
+    src/CTexturedPlane.cpp
+    PROPERTIES COMPILE_OPTIONS "-O1"
+)
+
 if (MRPT_OPENGL_PROFILER)
 	target_compile_definitions(opengl PRIVATE MRPT_OPENGL_PROFILER)
 endif()
