diff --git a/Generals/Code/GameEngine/Source/Common/Dict.cpp b/Generals/Code/GameEngine/Source/Common/Dict.cpp index 340d6399e2..3aaa9e272b 100644 --- a/Generals/Code/GameEngine/Source/Common/Dict.cpp +++ b/Generals/Code/GameEngine/Source/Common/Dict.cpp @@ -160,6 +160,7 @@ Dict::DictPair *Dict::ensureUnique(int numPairsNeeded, Bool preserveData, DictPa Dict::DictPairData* newData = NULL; if (numPairsNeeded > 0) { + DEBUG_ASSERTCRASH(TheDynamicMemoryAllocator != NULL, ("Cannot use dynamic memory allocator before its initialization. Check static initialization order.\n")); DEBUG_ASSERTCRASH(numPairsNeeded <= MAX_LEN, ("Dict::ensureUnique exceeds max pairs length %d with requested length %d", MAX_LEN, numPairsNeeded)); int minBytes = sizeof(Dict::DictPairData) + numPairsNeeded*sizeof(Dict::DictPair); int actualBytes = TheDynamicMemoryAllocator->getActualAllocationSize(minBytes); diff --git a/Generals/Code/GameEngine/Source/Common/MiniLog.cpp b/Generals/Code/GameEngine/Source/Common/MiniLog.cpp index f23e97d238..eb51834b43 100644 --- a/Generals/Code/GameEngine/Source/Common/MiniLog.cpp +++ b/Generals/Code/GameEngine/Source/Common/MiniLog.cpp @@ -46,9 +46,9 @@ LogClass::LogClass(const char *fname) } pEnd--; } - AsciiString fullPath; - fullPath.format("%s\\%s", buffer, fname); - m_fp = fopen(fullPath.str(), "wt"); + // TheSuperHackers @fix Caball009 03/06/2025 Don't use AsciiString here anymore because its memory allocator may not have been initialized yet. + const std::string fullPath = std::string(buffer) + "\\" + fname; + m_fp = fopen(fullPath.c_str(), "wt"); } LogClass::~LogClass() diff --git a/Generals/Code/GameEngine/Source/Common/System/AsciiString.cpp b/Generals/Code/GameEngine/Source/Common/System/AsciiString.cpp index f8c757bacf..743b493357 100644 --- a/Generals/Code/GameEngine/Source/Common/System/AsciiString.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/AsciiString.cpp @@ -138,6 +138,7 @@ void AsciiString::ensureUniqueBufferOfSize(int numCharsNeeded, Bool preserveData return; } + DEBUG_ASSERTCRASH(TheDynamicMemoryAllocator != NULL, ("Cannot use dynamic memory allocator before its initialization. Check static initialization order.\n")); DEBUG_ASSERTCRASH(numCharsNeeded <= MAX_LEN, ("AsciiString::ensureUniqueBufferOfSize exceeds max string length %d with requested length %d", MAX_LEN, numCharsNeeded)); int minBytes = sizeof(AsciiStringData) + numCharsNeeded*sizeof(char); int actualBytes = TheDynamicMemoryAllocator->getActualAllocationSize(minBytes); diff --git a/Generals/Code/GameEngine/Source/Common/System/UnicodeString.cpp b/Generals/Code/GameEngine/Source/Common/System/UnicodeString.cpp index 4a448d9135..77f70711f4 100644 --- a/Generals/Code/GameEngine/Source/Common/System/UnicodeString.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/UnicodeString.cpp @@ -94,6 +94,7 @@ void UnicodeString::ensureUniqueBufferOfSize(int numCharsNeeded, Bool preserveDa return; } + DEBUG_ASSERTCRASH(TheDynamicMemoryAllocator != NULL, ("Cannot use dynamic memory allocator before its initialization. Check static initialization order.\n")); DEBUG_ASSERTCRASH(numCharsNeeded <= MAX_LEN, ("UnicodeString::ensureUniqueBufferOfSize exceeds max string length %d with requested length %d", MAX_LEN, numCharsNeeded)); int minBytes = sizeof(UnicodeStringData) + numCharsNeeded*sizeof(WideChar); int actualBytes = TheDynamicMemoryAllocator->getActualAllocationSize(minBytes); diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp index 429b71813c..d2d735ae7b 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp @@ -114,9 +114,9 @@ LogClass::LogClass(const char *fname) } pEnd--; } - AsciiString fullPath; - fullPath.format("%s\\%s", buffer, fname); - m_fp = fopen(fullPath.str(), "wt"); + // TheSuperHackers @fix Caball009 03/06/2025 Don't use AsciiString here anymore because its memory allocator may not have been initialized yet. + const std::string fullPath = std::string(buffer) + "\\" + fname; + m_fp = fopen(fullPath.c_str(), "wt"); } LogClass::~LogClass() diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp index 2c2d491ca0..4e78c872eb 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp @@ -162,9 +162,9 @@ StatDumpClass::StatDumpClass( const char *fname ) } pEnd--; } - AsciiString fullPath; - fullPath.format( "%s\\%s", buffer, fname ); - m_fp = fopen( fullPath.str(), "wt" ); + // TheSuperHackers @fix Caball009 03/06/2025 Don't use AsciiString here anymore because its memory allocator may not have been initialized yet. + const std::string fullPath = std::string(buffer) + "\\" + fname; + m_fp = fopen(fullPath.c_str(), "wt"); } //============================================================================= diff --git a/GeneralsMD/Code/GameEngine/Source/Common/Dict.cpp b/GeneralsMD/Code/GameEngine/Source/Common/Dict.cpp index 590e32fbb8..6fed812fc9 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/Dict.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/Dict.cpp @@ -160,6 +160,7 @@ Dict::DictPair *Dict::ensureUnique(int numPairsNeeded, Bool preserveData, DictPa Dict::DictPairData* newData = NULL; if (numPairsNeeded > 0) { + DEBUG_ASSERTCRASH(TheDynamicMemoryAllocator != NULL, ("Cannot use dynamic memory allocator before its initialization. Check static initialization order.\n")); DEBUG_ASSERTCRASH(numPairsNeeded <= MAX_LEN, ("Dict::ensureUnique exceeds max pairs length %d with requested length %d", MAX_LEN, numPairsNeeded)); int minBytes = sizeof(Dict::DictPairData) + numPairsNeeded*sizeof(Dict::DictPair); int actualBytes = TheDynamicMemoryAllocator->getActualAllocationSize(minBytes); diff --git a/GeneralsMD/Code/GameEngine/Source/Common/MiniLog.cpp b/GeneralsMD/Code/GameEngine/Source/Common/MiniLog.cpp index 5b20fb361c..2080dcf278 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/MiniLog.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/MiniLog.cpp @@ -46,9 +46,9 @@ LogClass::LogClass(const char *fname) } pEnd--; } - AsciiString fullPath; - fullPath.format("%s\\%s", buffer, fname); - m_fp = fopen(fullPath.str(), "wt"); + // TheSuperHackers @fix Caball009 03/06/2025 Don't use AsciiString here anymore because its memory allocator may not have been initialized yet. + const std::string fullPath = std::string(buffer) + "\\" + fname; + m_fp = fopen(fullPath.c_str(), "wt"); } LogClass::~LogClass() diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/AsciiString.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/AsciiString.cpp index a872591bb7..7250d53b5a 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/AsciiString.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/AsciiString.cpp @@ -138,6 +138,7 @@ void AsciiString::ensureUniqueBufferOfSize(int numCharsNeeded, Bool preserveData return; } + DEBUG_ASSERTCRASH(TheDynamicMemoryAllocator != NULL, ("Cannot use dynamic memory allocator before its initialization. Check static initialization order.\n")); DEBUG_ASSERTCRASH(numCharsNeeded <= MAX_LEN, ("AsciiString::ensureUniqueBufferOfSize exceeds max string length %d with requested length %d", MAX_LEN, numCharsNeeded)); int minBytes = sizeof(AsciiStringData) + numCharsNeeded*sizeof(char); int actualBytes = TheDynamicMemoryAllocator->getActualAllocationSize(minBytes); diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/UnicodeString.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/UnicodeString.cpp index 61d624031f..235e9f8868 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/UnicodeString.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/UnicodeString.cpp @@ -94,6 +94,7 @@ void UnicodeString::ensureUniqueBufferOfSize(int numCharsNeeded, Bool preserveDa return; } + DEBUG_ASSERTCRASH(TheDynamicMemoryAllocator != NULL, ("Cannot use dynamic memory allocator before its initialization. Check static initialization order.\n")); DEBUG_ASSERTCRASH(numCharsNeeded <= MAX_LEN, ("UnicodeString::ensureUniqueBufferOfSize exceeds max string length %d with requested length %d", MAX_LEN, numCharsNeeded)); int minBytes = sizeof(UnicodeStringData) + numCharsNeeded*sizeof(WideChar); int actualBytes = TheDynamicMemoryAllocator->getActualAllocationSize(minBytes); diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp index 85537b9388..44d13bb5ca 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp @@ -114,9 +114,9 @@ LogClass::LogClass(const char *fname) } pEnd--; } - AsciiString fullPath; - fullPath.format("%s\\%s", buffer, fname); - m_fp = fopen(fullPath.str(), "wt"); + // TheSuperHackers @fix Caball009 03/06/2025 Don't use AsciiString here anymore because its memory allocator may not have been initialized yet. + const std::string fullPath = std::string(buffer) + "\\" + fname; + m_fp = fopen(fullPath.c_str(), "wt"); } LogClass::~LogClass() diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp index bf282b3196..e3e00762d4 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp @@ -163,9 +163,9 @@ StatDumpClass::StatDumpClass( const char *fname ) } pEnd--; } - AsciiString fullPath; - fullPath.format( "%s\\%s", buffer, fname ); - m_fp = fopen( fullPath.str(), "wt" ); + // TheSuperHackers @fix Caball009 03/06/2025 Don't use AsciiString here anymore because its memory allocator may not have been initialized yet. + const std::string fullPath = std::string(buffer) + "\\" + fname; + m_fp = fopen(fullPath.c_str(), "wt"); } //=============================================================================