1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-17 20:13:07 +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

@@ -456,17 +456,17 @@ public:
}
};
static std::unique_ptr<TrackDesignRepository> _trackDesignRepository;
static TrackDesignRepository * _trackDesignRepository = nullptr;
ITrackDesignRepository * CreateTrackDesignRepository(IPlatformEnvironment * env)
{
_trackDesignRepository = std::unique_ptr<TrackDesignRepository>(new TrackDesignRepository(env));
return _trackDesignRepository.get();
_trackDesignRepository = new TrackDesignRepository(env);
return _trackDesignRepository;
}
ITrackDesignRepository * GetTrackDesignRepository()
{
return _trackDesignRepository.get();
return _trackDesignRepository;
}
extern "C"