From e99c29df9469ad01a4d715abf666f83eb9c2ca5f Mon Sep 17 00:00:00 2001 From: Caball009 <82909616+Caball009@users.noreply.github.com> Date: Tue, 3 Jun 2025 23:03:53 +0200 Subject: [PATCH 1/6] Fix StatDumpClass initialization. --- .../Source/W3DDevice/GameClient/W3DDisplay.cpp | 7 ++++--- .../Source/W3DDevice/GameClient/W3DDisplay.cpp | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp index 2c2d491ca0..0e25e2e5e4 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp @@ -162,9 +162,10 @@ StatDumpClass::StatDumpClass( const char *fname ) } pEnd--; } - AsciiString fullPath; - fullPath.format( "%s\\%s", buffer, fname ); - m_fp = fopen( fullPath.str(), "wt" ); + // TheSuperHackers @bugfix Caball009 03/06/2025 Use std::string instead of AsciiString here to avoid possible static initialization order fiasco + // TheDynamicMemoryAllocator is used by AsciiString and 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/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp index bf282b3196..b36a88db28 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp @@ -163,9 +163,10 @@ StatDumpClass::StatDumpClass( const char *fname ) } pEnd--; } - AsciiString fullPath; - fullPath.format( "%s\\%s", buffer, fname ); - m_fp = fopen( fullPath.str(), "wt" ); + // TheSuperHackers @bugfix Caball009 03/06/2025 Use std::string instead of AsciiString here to avoid possible static initialization order fiasco + // TheDynamicMemoryAllocator is used by AsciiString and may not have been initialized yet + const std::string fullPath = std::string(buffer) + "\\" + fname; + m_fp = fopen(fullPath.c_str(), "wt"); } //============================================================================= From 259cde30ec65f0997dc6215a7cb84decbb1d9bf0 Mon Sep 17 00:00:00 2001 From: Caball009 <82909616+Caball009@users.noreply.github.com> Date: Tue, 3 Jun 2025 23:04:53 +0200 Subject: [PATCH 2/6] Fix LogClass initialization. --- Generals/Code/GameEngine/Source/Common/MiniLog.cpp | 7 ++++--- GeneralsMD/Code/GameEngine/Source/Common/MiniLog.cpp | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Generals/Code/GameEngine/Source/Common/MiniLog.cpp b/Generals/Code/GameEngine/Source/Common/MiniLog.cpp index f23e97d238..a2e9a0d5c6 100644 --- a/Generals/Code/GameEngine/Source/Common/MiniLog.cpp +++ b/Generals/Code/GameEngine/Source/Common/MiniLog.cpp @@ -46,9 +46,10 @@ LogClass::LogClass(const char *fname) } pEnd--; } - AsciiString fullPath; - fullPath.format("%s\\%s", buffer, fname); - m_fp = fopen(fullPath.str(), "wt"); + // TheSuperHackers @bugfix Caball009 03/06/2025 Use std::string instead of AsciiString here to avoid possible static initialization order fiasco + // TheDynamicMemoryAllocator is used by AsciiString and 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/MiniLog.cpp b/GeneralsMD/Code/GameEngine/Source/Common/MiniLog.cpp index 5b20fb361c..7e34ed5fcc 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/MiniLog.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/MiniLog.cpp @@ -46,9 +46,10 @@ LogClass::LogClass(const char *fname) } pEnd--; } - AsciiString fullPath; - fullPath.format("%s\\%s", buffer, fname); - m_fp = fopen(fullPath.str(), "wt"); + // TheSuperHackers @bugfix Caball009 03/06/2025 Use std::string instead of AsciiString here to avoid possible static initialization order fiasco + // TheDynamicMemoryAllocator is used by AsciiString and may not have been initialized yet + const std::string fullPath = std::string(buffer) + "\\" + fname; + m_fp = fopen(fullPath.c_str(), "wt"); } LogClass::~LogClass() From 81c42f79281fa7fbce6b09d0cd83ed7914223f5d Mon Sep 17 00:00:00 2001 From: Caball009 <82909616+Caball009@users.noreply.github.com> Date: Tue, 3 Jun 2025 23:07:17 +0200 Subject: [PATCH 3/6] Fix LogClass initialization. --- .../W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp | 7 ++++--- .../W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) 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..f56df2f94d 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,10 @@ LogClass::LogClass(const char *fname) } pEnd--; } - AsciiString fullPath; - fullPath.format("%s\\%s", buffer, fname); - m_fp = fopen(fullPath.str(), "wt"); + // TheSuperHackers @bugfix Caball009 03/06/2025 Use std::string instead of AsciiString here to avoid possible static initialization order fiasco + // TheDynamicMemoryAllocator is used by AsciiString and 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/Drawable/Draw/W3DModelDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp index 85537b9388..ce63fa25db 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,10 @@ LogClass::LogClass(const char *fname) } pEnd--; } - AsciiString fullPath; - fullPath.format("%s\\%s", buffer, fname); - m_fp = fopen(fullPath.str(), "wt"); + // TheSuperHackers @bugfix Caball009 03/06/2025 Use std::string instead of AsciiString here to avoid possible static initialization order fiasco + // TheDynamicMemoryAllocator is used by AsciiString and may not have been initialized yet + const std::string fullPath = std::string(buffer) + "\\" + fname; + m_fp = fopen(fullPath.c_str(), "wt"); } LogClass::~LogClass() From 73bf304697a448160d62d39b6f3edb35396cb08c Mon Sep 17 00:00:00 2001 From: Caball009 <82909616+Caball009@users.noreply.github.com> Date: Tue, 3 Jun 2025 23:42:42 +0200 Subject: [PATCH 4/6] Added debug assertions before using TheDynamicMemoryAllocator pointer. --- Generals/Code/GameEngine/Source/Common/Dict.cpp | 1 + Generals/Code/GameEngine/Source/Common/System/AsciiString.cpp | 1 + Generals/Code/GameEngine/Source/Common/System/UnicodeString.cpp | 1 + GeneralsMD/Code/GameEngine/Source/Common/Dict.cpp | 1 + GeneralsMD/Code/GameEngine/Source/Common/System/AsciiString.cpp | 1 + .../Code/GameEngine/Source/Common/System/UnicodeString.cpp | 1 + 6 files changed, 6 insertions(+) diff --git a/Generals/Code/GameEngine/Source/Common/Dict.cpp b/Generals/Code/GameEngine/Source/Common/Dict.cpp index 340d6399e2..4578a3dfc5 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.")); 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/System/AsciiString.cpp b/Generals/Code/GameEngine/Source/Common/System/AsciiString.cpp index f8c757bacf..0a566026e4 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.")); 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..9f93ae6cda 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.")); 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/GameEngine/Source/Common/Dict.cpp b/GeneralsMD/Code/GameEngine/Source/Common/Dict.cpp index 590e32fbb8..0184f69bc1 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.")); 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/System/AsciiString.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/AsciiString.cpp index a872591bb7..a657a57003 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.")); 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..f3e8f154ca 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.")); 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); From c7d8dcd32589b42709127aadc7319d07038060b8 Mon Sep 17 00:00:00 2001 From: Caball009 <82909616+Caball009@users.noreply.github.com> Date: Tue, 10 Jun 2025 05:54:49 +0200 Subject: [PATCH 5/6] Added newline to DEBUG_ASSERTCRASH messages. --- Generals/Code/GameEngine/Source/Common/Dict.cpp | 2 +- Generals/Code/GameEngine/Source/Common/System/AsciiString.cpp | 2 +- Generals/Code/GameEngine/Source/Common/System/UnicodeString.cpp | 2 +- GeneralsMD/Code/GameEngine/Source/Common/Dict.cpp | 2 +- GeneralsMD/Code/GameEngine/Source/Common/System/AsciiString.cpp | 2 +- .../Code/GameEngine/Source/Common/System/UnicodeString.cpp | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Generals/Code/GameEngine/Source/Common/Dict.cpp b/Generals/Code/GameEngine/Source/Common/Dict.cpp index 4578a3dfc5..3aaa9e272b 100644 --- a/Generals/Code/GameEngine/Source/Common/Dict.cpp +++ b/Generals/Code/GameEngine/Source/Common/Dict.cpp @@ -160,7 +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.")); + 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/System/AsciiString.cpp b/Generals/Code/GameEngine/Source/Common/System/AsciiString.cpp index 0a566026e4..743b493357 100644 --- a/Generals/Code/GameEngine/Source/Common/System/AsciiString.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/AsciiString.cpp @@ -138,7 +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.")); + 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 9f93ae6cda..77f70711f4 100644 --- a/Generals/Code/GameEngine/Source/Common/System/UnicodeString.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/UnicodeString.cpp @@ -94,7 +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.")); + 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/GameEngine/Source/Common/Dict.cpp b/GeneralsMD/Code/GameEngine/Source/Common/Dict.cpp index 0184f69bc1..6fed812fc9 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/Dict.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/Dict.cpp @@ -160,7 +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.")); + 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/System/AsciiString.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/AsciiString.cpp index a657a57003..7250d53b5a 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/AsciiString.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/AsciiString.cpp @@ -138,7 +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.")); + 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 f3e8f154ca..235e9f8868 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/UnicodeString.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/UnicodeString.cpp @@ -94,7 +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.")); + 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); From c994a5962aac3c61333368cff9c848bc95c52e6e Mon Sep 17 00:00:00 2001 From: Caball009 <82909616+Caball009@users.noreply.github.com> Date: Tue, 10 Jun 2025 05:55:16 +0200 Subject: [PATCH 6/6] Simplied 'TheSuperHackers' comments. --- Generals/Code/GameEngine/Source/Common/MiniLog.cpp | 3 +-- .../Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp | 3 +-- .../Source/W3DDevice/GameClient/W3DDisplay.cpp | 3 +-- GeneralsMD/Code/GameEngine/Source/Common/MiniLog.cpp | 3 +-- .../Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp | 3 +-- .../Source/W3DDevice/GameClient/W3DDisplay.cpp | 3 +-- 6 files changed, 6 insertions(+), 12 deletions(-) diff --git a/Generals/Code/GameEngine/Source/Common/MiniLog.cpp b/Generals/Code/GameEngine/Source/Common/MiniLog.cpp index a2e9a0d5c6..eb51834b43 100644 --- a/Generals/Code/GameEngine/Source/Common/MiniLog.cpp +++ b/Generals/Code/GameEngine/Source/Common/MiniLog.cpp @@ -46,8 +46,7 @@ LogClass::LogClass(const char *fname) } pEnd--; } - // TheSuperHackers @bugfix Caball009 03/06/2025 Use std::string instead of AsciiString here to avoid possible static initialization order fiasco - // TheDynamicMemoryAllocator is used by AsciiString and may not have been initialized yet + // 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/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp index f56df2f94d..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,8 +114,7 @@ LogClass::LogClass(const char *fname) } pEnd--; } - // TheSuperHackers @bugfix Caball009 03/06/2025 Use std::string instead of AsciiString here to avoid possible static initialization order fiasco - // TheDynamicMemoryAllocator is used by AsciiString and may not have been initialized yet + // 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/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp index 0e25e2e5e4..4e78c872eb 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp @@ -162,8 +162,7 @@ StatDumpClass::StatDumpClass( const char *fname ) } pEnd--; } - // TheSuperHackers @bugfix Caball009 03/06/2025 Use std::string instead of AsciiString here to avoid possible static initialization order fiasco - // TheDynamicMemoryAllocator is used by AsciiString and may not have been initialized yet + // 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/MiniLog.cpp b/GeneralsMD/Code/GameEngine/Source/Common/MiniLog.cpp index 7e34ed5fcc..2080dcf278 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/MiniLog.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/MiniLog.cpp @@ -46,8 +46,7 @@ LogClass::LogClass(const char *fname) } pEnd--; } - // TheSuperHackers @bugfix Caball009 03/06/2025 Use std::string instead of AsciiString here to avoid possible static initialization order fiasco - // TheDynamicMemoryAllocator is used by AsciiString and may not have been initialized yet + // 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/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp index ce63fa25db..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,8 +114,7 @@ LogClass::LogClass(const char *fname) } pEnd--; } - // TheSuperHackers @bugfix Caball009 03/06/2025 Use std::string instead of AsciiString here to avoid possible static initialization order fiasco - // TheDynamicMemoryAllocator is used by AsciiString and may not have been initialized yet + // 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/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp index b36a88db28..e3e00762d4 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp @@ -163,8 +163,7 @@ StatDumpClass::StatDumpClass( const char *fname ) } pEnd--; } - // TheSuperHackers @bugfix Caball009 03/06/2025 Use std::string instead of AsciiString here to avoid possible static initialization order fiasco - // TheDynamicMemoryAllocator is used by AsciiString and may not have been initialized yet + // 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"); }