netgen/libsrc
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
..
core unify MPI 2022-05-06 16:39:06 +02:00
csg Eliminate a "C++ initialization order fiasco" for geometryregister 2022-05-22 11:29:10 -04:00
general remove old mpi-wrapper 2022-05-06 18:21:44 +02:00
geom2d Eliminate a "C++ initialization order fiasco" for geometryregister 2022-05-22 11:29:10 -04:00
gprim rework build system, separate gui and non-gui code 2022-05-05 14:39:31 +02:00
include move ngtcl.hpp interface to meshing/visual_interface.hpp 2022-05-06 12:23:50 +02:00
interface Eliminate a "C++ initialization order fiasco" for geometryregister 2022-05-22 11:29:10 -04:00
linalg rework build system, separate gui and non-gui code 2022-05-05 14:39:31 +02:00
meshing Eliminate a "C++ initialization order fiasco" for geometryregister 2022-05-22 11:29:10 -04:00
occ Eliminate a "C++ initialization order fiasco" for geometryregister 2022-05-22 11:29:10 -04:00
stlgeom Eliminate a "C++ initialization order fiasco" for geometryregister 2022-05-22 11:29:10 -04:00
visualization Eliminate a "C++ initialization order fiasco" for geometryregister 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