1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-16 03:23:15 +01:00

ensure _objectRepository and _objectManager are freed

This commit is contained in:
Ted John
2016-07-07 23:05:55 +01:00
parent 3f19becc2b
commit 8b03b996c0
2 changed files with 8 additions and 6 deletions

View File

@@ -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"