diff --git a/openhantek/src/hantekdso/modelregistry.cpp b/openhantek/src/hantekdso/modelregistry.cpp index 7c3f9c5..4606b3e 100644 --- a/openhantek/src/hantekdso/modelregistry.cpp +++ b/openhantek/src/hantekdso/modelregistry.cpp @@ -2,9 +2,10 @@ #include "modelregistry.h" -ModelRegistry *ModelRegistry::instance = new ModelRegistry(); - -ModelRegistry *ModelRegistry::get() { return instance; } +ModelRegistry *ModelRegistry::get() { + static ModelRegistry inst; + return &inst; +} void ModelRegistry::add(DSOModel *model) { supportedModels.push_back(model); } diff --git a/openhantek/src/hantekdso/modelregistry.h b/openhantek/src/hantekdso/modelregistry.h index 31289db..f45d519 100644 --- a/openhantek/src/hantekdso/modelregistry.h +++ b/openhantek/src/hantekdso/modelregistry.h @@ -11,6 +11,5 @@ public: void add(DSOModel* model); const std::list models() const; private: - static ModelRegistry* instance; std::list supportedModels; };