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

Fix premature deletion of dependencies (#5952)

In particular, the object repository can potentially be deleted before the object manager is deleted. This causes a crash when the object manager is deleted because it requires the object repository within the destructor.
This commit is contained in:
Ted John
2017-07-20 17:44:31 +01:00
committed by GitHub
parent 260f342d73
commit 2eb9657781
5 changed files with 29 additions and 16 deletions

View File

@@ -698,17 +698,17 @@ private:
}
};
static std::unique_ptr<ObjectRepository> _objectRepository;
static ObjectRepository * _objectRepository = nullptr;
IObjectRepository * CreateObjectRepository(IPlatformEnvironment * env)
{
_objectRepository = std::unique_ptr<ObjectRepository>(new ObjectRepository(env));
return _objectRepository.get();
_objectRepository = new ObjectRepository(env);
return _objectRepository;
}
IObjectRepository * GetObjectRepository()
{
return _objectRepository.get();
return _objectRepository;
}
bool IsObjectCustom(const ObjectRepositoryItem * object)