Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Eliminate a "C++ initialization order fiasco" for geometryregister #125

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on May 22, 2022

  1. 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.
    xiphmont committed May 22, 2022
    Configuration menu
    Copy the full SHA
    de7ffc5 View commit details
    Browse the repository at this point in the history