diff --git a/src/openrct2/Context.cpp b/src/openrct2/Context.cpp index 6e7a92fd44..2bd2ea66a9 100644 --- a/src/openrct2/Context.cpp +++ b/src/openrct2/Context.cpp @@ -134,6 +134,9 @@ namespace OpenRCT2 , _uiContext(uiContext) , _localisationService(std::make_unique(env)) { + // Can't have more than one context currently. + Guard::Assert(Instance == nullptr); + Instance = this; } diff --git a/test/tests/TileElements.cpp b/test/tests/TileElements.cpp index 738f3c2971..5456a0cf2a 100644 --- a/test/tests/TileElements.cpp +++ b/test/tests/TileElements.cpp @@ -36,6 +36,12 @@ protected: SUCCEED(); } + static void TearDownTestCase() + { + if (_context) + _context.reset(); + } + private: static std::shared_ptr _context; };