浏览代码

Possible fix for https://bugs.vcmi.eu/view.php?id=2913

AlexVinS 7 年之前
父节点
当前提交
7d27d144a5
共有 1 个文件被更改,包括 1 次插入4 次删除
  1. 1 4
      lib/spells/effects/Registry.cpp

+ 1 - 4
lib/spells/effects/Registry.cpp

@@ -16,8 +16,6 @@ namespace spells
 namespace effects
 {
 
-std::unique_ptr<Registry> Instance;
-
 namespace detail
 {
 class RegistryImpl : public Registry
@@ -53,8 +51,7 @@ Registry::~Registry() = default;
 
 Registry * Registry::get()
 {
-	if(!Instance)
-		Instance = make_unique<detail::RegistryImpl>();
+	static std::unique_ptr<Registry> Instance = make_unique<detail::RegistryImpl>();
 	return Instance.get();
 }