diff --git a/rts/System/Platform/Win/win32.h b/rts/System/Platform/Win/win32.h index 81bf95fdb31..57c61feb791 100644 --- a/rts/System/Platform/Win/win32.h +++ b/rts/System/Platform/Win/win32.h @@ -31,6 +31,7 @@ #undef DeleteFile #undef SendMessage #undef GetCharWidth + #undef MemoryBarrier #undef far #undef near #undef FAR diff --git a/test/unitsync/testUnitSync.cpp b/test/unitsync/testUnitSync.cpp index 338e31801b0..0aec702e3fe 100644 --- a/test/unitsync/testUnitSync.cpp +++ b/test/unitsync/testUnitSync.cpp @@ -350,4 +350,12 @@ TEST_CASE("UnitSync") if ((errmsg = us::GetNextError()) == nullptr) { FAIL_CHECK("No error on GetWritableDataDirectory before init"); // there's an error cause we called GetWritableDataDirectory() after UnInit()! } + + // Exercise repeated initialization and shutdown. + for (int cycle = 0; cycle < 2; ++cycle) { + CHECK(us::Init(false, 0) != 0); + CHECK_ERROR_MESSAGE(errmsg); + us::UnInit(); + CHECK_ERROR_MESSAGE(errmsg); + } } diff --git a/tools/unitsync/unitsync.cpp b/tools/unitsync/unitsync.cpp index 7da1def5408..5140328b99c 100644 --- a/tools/unitsync/unitsync.cpp +++ b/tools/unitsync/unitsync.cpp @@ -12,6 +12,7 @@ // shared with spring: #include "lib/lua/include/LuaInclude.h" #include "Game/GameVersion.h" +#include "Lua/LuaMemPool.h" #include "Lua/LuaParser.h" #include "Map/MapParser.h" #include "Map/ReadMap.h" @@ -421,6 +422,7 @@ EXPORT(void) UnInit() try { _Cleanup(); FileSystemInitializer::Cleanup(); + LuaMemPool::KillStatic(); ConfigHandler::Deallocate(); DataDirLocater::FreeInstance(); } @@ -2371,4 +2373,3 @@ EXPORT(const char*) GetMacAddrHash() { memcpy(macAddrBuf.data(), macAddrHash.data(), std::min(macAddrHash.size(), macAddrBuf.size())); return (macAddrBuf.data()); } -