1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-06 06:32:56 +01:00

Destroy context in TileElementWantsFootpathConnection::TearDownTestCase

Not destroying the context might upset some compilers due to the order
of destruction of variables the context might still require.
This commit is contained in:
Michał Janiszewski
2018-04-21 23:03:03 +02:00
committed by Ted John
parent 466c465d44
commit 090c444353

View File

@@ -28,6 +28,22 @@ protected:
SUCCEED();
}
static void TearDownTestCase()
{
// FIXME: If this is not reset here, the context will outlive
// _availableObjectStringIds from Language.cpp, but upon its destruction
// OpenRCT2::Context::~Context() ../src/openrct2/Context.cpp:135
// object_manager_unload_all_objects() ../src/openrct2/object/ObjectManager.cpp:620
// ObjectManager::UnloadAll() ../src/openrct2/object/ObjectManager.cpp:207
// ObjectManager::UnloadObject(Object*) ../src/openrct2/object/ObjectManager.cpp:329
// RideObject::Unload() ../src/openrct2/object/RideObject.cpp:334
// language_free_object_string(unsigned short) ../src/openrct2/localisation/Language.cpp:274
// wants to access _availableObjectStringIds, which is already gone.
//
// This hack evicts context and ensures _availableObjectStringIds is
// available for the time we want to use it, until a better solution is implemented.
_context.reset();
}
private:
static std::shared_ptr<IContext> _context;
};