mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-24 00:03:11 +01:00
Fix #15442: Use after free in object manager
This commit is contained in:
@@ -63,15 +63,18 @@ namespace Editor
|
||||
|
||||
static void object_list_load()
|
||||
{
|
||||
auto* context = GetContext();
|
||||
|
||||
// Unload objects first, the repository is re-populated which owns the objects.
|
||||
auto& objectManager = context->GetObjectManager();
|
||||
objectManager.UnloadAll();
|
||||
|
||||
// Scan objects if necessary
|
||||
auto context = GetContext();
|
||||
const auto& localisationService = context->GetLocalisationService();
|
||||
auto& objectRepository = context->GetObjectRepository();
|
||||
objectRepository.LoadOrConstruct(localisationService.GetCurrentLanguage());
|
||||
|
||||
// Reset loaded objects to just defaults
|
||||
auto& objectManager = context->GetObjectManager();
|
||||
objectManager.UnloadAll();
|
||||
objectManager.LoadDefaultObjects();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user