Because of the indeterminate static initialization order in C++, it is currently not safe to use Features as global variables.
Features relies on a a global hashmap in order to ensure that only one FeatureStore per process is opened for any given GOL. When a global Features object is destroyed, its associated FeatureStore is removed from this hashmap. However, since destruction order of globals is indeterminate, this hashmap may already have been destroyed, resulting in a crash.
To avoid this, we would need to wrap the hashmap in a class that maintains an "alive" flag (set to true by constructor, cleared by destructor). Once that flag is cleared, the hashmap must no longer be accessed.
Because of the indeterminate static initialization order in C++, it is currently not safe to use
Featuresas global variables.Featuresrelies on a a global hashmap in order to ensure that only oneFeatureStoreper process is opened for any given GOL. When a globalFeaturesobject is destroyed, its associatedFeatureStoreis removed from this hashmap. However, since destruction order of globals is indeterminate, this hashmap may already have been destroyed, resulting in a crash.To avoid this, we would need to wrap the hashmap in a class that maintains an "alive" flag (set to
trueby constructor, cleared by destructor). Once that flag is cleared, the hashmap must no longer be accessed.