Fix utlvector and utlstring destructor bug

Fix duplicate call to CUtlMemory<T>::Purge. This was caused due to an extra call performed in the destructor of CUtlVector and CUtlString. Disassembling the DLL after performing these changes revealed the destructor of the allocator is only getting called once now; the issue has been fixed.
This commit is contained in:
Kawe Mazidjatari 2023-05-01 22:49:53 +02:00
parent 629b7cd8a2
commit c02e738866
2 changed files with 2 additions and 10 deletions

View File

@ -32,15 +32,6 @@ public:
#else
m_nActualLength = 0;
#endif
// Has to be explicitly called due to the
// current design of our SDK. Unlike other
// Source Engine games, we couldn't import
// the memalloc singleton as the executable
// is monolithic; we obtain it post init
// (too late for binding it against the
// new/delete operators..).
m_Memory.~CUtlMemory();
}
// NOTE: nInitialLength indicates how much of the buffer starts full

View File

@ -648,7 +648,8 @@ inline CUtlVector<T, A>::CUtlVector(T* pMemory, int allocationCount, int numElem
template< typename T, class A >
inline CUtlVector<T, A>::~CUtlVector()
{
Purge();
RemoveAll();
// Destructor of allocator calls purge.
}
template< typename T, class A >