netgen/libsrc/stlgeom
Monty Montgomery de7ffc5906 Eliminate a "C++ initialization order fiasco" for geometryregister
Current initialization of the global geometryregister suffers from a
classic 'initialization order fiasco'.  Depending on the order the
compilation units are loaded/linked, the initialization of the global
geometryregisterarray is not guaranteed to happen (and indeed often
does not happen) before it is used.  This leads to entries being
appended before it's initialized (usually 'suceeding, but potentially
causing memory corruption if the segment at that point isn't zeroed),
initialization then happening halfway through (wiping the initial
entries) and then the last entries being the only ones that show up.

The net effect is either a crash at startup, or several geometry types
seeming to be missing.  Eg, step files will oad, but STL files are
just ignored.  The bug is actively observed on, eg, Linux.

This patch implements a simple 'initialize at first access' convention
for the array, eliminating the ordering problem.

I've not reviewed the rest of the source for other potential examples
of the fiasco pattern; this fixes only the geometryregister, since
that was actively biting.
2022-05-22 11:29:10 -04:00
..
CMakeLists.txt rework build system, separate gui and non-gui code 2022-05-05 14:39:31 +02:00
meshstlsurface.cpp add closeedge meshsize to base geometry (not used) 2019-11-04 19:34:46 +01:00
meshstlsurface.hpp Implement MeshOptimizeSTLSurface::ProjectPointGI 2019-10-08 14:40:40 +02:00
python_stl.cpp load geometries from command line with python netgen executable 2022-04-28 10:46:49 +02:00
stlgeom.cpp Eliminate a "C++ initialization order fiasco" for geometryregister 2022-05-22 11:29:10 -04:00
stlgeom.hpp rework build system, separate gui and non-gui code 2022-05-05 14:39:31 +02:00
stlgeomchart.cpp Use searchtree in STLBoundary 2019-10-01 12:19:22 +02:00
stlgeommesh.cpp fixes for mac and windows 2019-11-05 15:19:54 +01:00
stlline.cpp more STL*Id 2019-09-22 13:15:53 +02:00
stlline.hpp use Point/Trig/Chart-Id in stl-meshing, more to come 2019-09-21 02:04:49 +02:00
stlpkg.cpp Eliminate a "C++ initialization order fiasco" for geometryregister 2022-05-22 11:29:10 -04:00
stltool.cpp add closeedge meshsize to base geometry (not used) 2019-11-04 19:34:46 +01:00
stltool.hpp add closeedge meshsize to base geometry (not used) 2019-11-04 19:34:46 +01:00
stltopology.cpp Fix various typos 2022-03-25 18:22:05 -04:00
stltopology.hpp rework build system, separate gui and non-gui code 2022-05-05 14:39:31 +02:00
vsstl.cpp Eliminate a "C++ initialization order fiasco" for geometryregister 2022-05-22 11:29:10 -04:00
vsstl.hpp rework build system, separate gui and non-gui code 2022-05-05 14:39:31 +02:00