1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-12-23 18:30:00 +00:00

Fixing possible leaks in CModelInfo::ShutDown

This commit is contained in:
Sergeanur 2020-01-23 20:08:42 +02:00
parent 18f80a02fc
commit b06ad84768
3 changed files with 26 additions and 2 deletions

View file

@ -2,6 +2,12 @@
#include "patcher.h" #include "patcher.h"
#include "Instance.h" #include "Instance.h"
void
CInstance::Shutdown()
{
GetMatrix().Detach();
}
class CInstance_ : public CInstance class CInstance_ : public CInstance
{ {
public: public:
@ -10,4 +16,5 @@ public:
STARTPATCHES STARTPATCHES
InjectHook(0x50BE90, &CInstance_::dtor, PATCH_JUMP); InjectHook(0x50BE90, &CInstance_::dtor, PATCH_JUMP);
InjectHook(0x50B850, &CInstance::Shutdown, PATCH_JUMP);
ENDPATCHES ENDPATCHES

View file

@ -10,4 +10,5 @@ public:
int m_modelIndex; int m_modelIndex;
public: public:
~CInstance() = default; ~CInstance() = default;
void Shutdown();
}; };

View file

@ -93,16 +93,32 @@ CModelInfo::ShutDown(void)
int i; int i;
for(i = 0; i < ms_simpleModelStore.allocPtr; i++) for(i = 0; i < ms_simpleModelStore.allocPtr; i++)
ms_simpleModelStore.store[i].Shutdown(); ms_simpleModelStore.store[i].Shutdown();
for(i = 0; i < ms_mloInstanceStore.allocPtr; i++)
ms_mloInstanceStore.store[i].Shutdown();
for(i = 0; i < ms_timeModelStore.allocPtr; i++) for(i = 0; i < ms_timeModelStore.allocPtr; i++)
ms_timeModelStore.store[i].Shutdown(); ms_timeModelStore.store[i].Shutdown();
for(i = 0; i < ms_clumpModelStore.allocPtr; i++) for(i = 0; i < ms_clumpModelStore.allocPtr; i++)
ms_clumpModelStore.store[i].Shutdown(); ms_clumpModelStore.store[i].Shutdown();
for(i = 0; i < ms_pedModelStore.allocPtr; i++)
ms_pedModelStore.store[i].Shutdown();
for(i = 0; i < ms_vehicleModelStore.allocPtr; i++) for(i = 0; i < ms_vehicleModelStore.allocPtr; i++)
ms_vehicleModelStore.store[i].Shutdown(); ms_vehicleModelStore.store[i].Shutdown();
for(i = 0; i < ms_pedModelStore.allocPtr; i++)
ms_pedModelStore.store[i].Shutdown();
for(i = 0; i < ms_xtraCompsModelStore.allocPtr; i++)
ms_xtraCompsModelStore.store[i].Shutdown();
for(i = 0; i < ms_mloInstanceStore.allocPtr; i++)
ms_mloInstanceStore.store[i].Shutdown();
for(i = 0; i < ms_2dEffectStore.allocPtr; i++) for(i = 0; i < ms_2dEffectStore.allocPtr; i++)
ms_2dEffectStore.store[i].Shutdown(); ms_2dEffectStore.store[i].Shutdown();
ms_2dEffectStore.clear();
ms_simpleModelStore.clear();
ms_mloInstanceStore.clear();
ms_mloModelStore.clear();
ms_xtraCompsModelStore.clear();
ms_timeModelStore.clear();
ms_pedModelStore.clear();
ms_clumpModelStore.clear();
ms_vehicleModelStore.clear();
} }
CSimpleModelInfo* CSimpleModelInfo*