OpenHantek / openhantek

OpenHantek is a DSO software for Hantek (Voltcraft/Darkwire/Protek/Acetech) USB digital signal oscilloscopes
http://openhantek.org/
GNU General Public License v3.0
771 stars 199 forks source link

Segfault on startup fix, #182 related #186

Closed phoyd closed 6 years ago

phoyd commented 6 years ago

Fixes a segfault on startup. The previous code assumed that ModelRegistry::instance would be initialized before being used by other static initializers.

However, static initialization order is undefined. Plus, at least unter C++11 and according to 6.7[stmt.decl] p.4, this initialization of get():inst is thread-safe.

(this might be relevant to https://github.com/OpenHantek/openhantek/issues/182)