forked from rosebudai/OpenRCT2-Web
ensure _objectRepository and _objectManager are freed
This commit is contained in:
1 parent
3f19becc2b
commit
8b03b996c0
2 files changed
+8
-6
No files matched your search
@@ -15,6 +15,7 @@
|
||||
#pragma endregion
|
||||
|
||||
#include <array>
|
||||
#include <memory>
|
||||
#include <unordered_set>
|
||||
#include "../core/Console.hpp"
|
||||
#include "../core/Memory.hpp"
|
||||
@@ -421,16 +422,16 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
ObjectManager * _objectManager;
|
||||
static std::unique_ptr<ObjectManager> _objectManager;
|
||||
|
||||
IObjectManager * GetObjectManager()
|
||||
{
|
||||
if (_objectManager == nullptr)
|
||||
{
|
||||
IObjectRepository * objectRepository = GetObjectRepository();
|
||||
_objectManager = new ObjectManager(objectRepository);
|
||||
_objectManager = std::unique_ptr<ObjectManager>(new ObjectManager(objectRepository));
|
||||
}
|
||||
return _objectManager;
|
||||
return _objectManager.get();
|
||||
}
|
||||
|
||||
extern "C"
|
||||
|
||||
Reference in new issue
Block a user