Merge pull request #795 from Arkaran99/master

Fix compile errors in Debug - MemLeak.
This commit is contained in:
Alexandro Sánchez Bach 2014-09-07 11:04:15 +02:00
commit e65676ffa9
8 changed files with 1834 additions and 1809 deletions

View File

@ -1,5 +1,7 @@
#include "stdafx.h" #include "stdafx.h"
#include "restore_new.h"
#include <wx/msgdlg.h> #include <wx/msgdlg.h>
#include "define_new_memleakdetect.h"
#include "rMsgBox.h" #include "rMsgBox.h"
#ifndef QT_UI #ifndef QT_UI

View File

@ -1,5 +1,7 @@
#include "stdafx.h" #include "stdafx.h"
#include "restore_new.h"
#include <wx/image.h> #include <wx/image.h>
#include "define_new_memleakdetect.h"
#ifndef _WIN32 #ifndef _WIN32
#include <dirent.h> #include <dirent.h>

View File

@ -4,7 +4,9 @@
#include "sha1.h" #include "sha1.h"
#include "key_vault.h" #include "key_vault.h"
#include "unpkg.h" #include "unpkg.h"
#include "restore_new.h"
#include <wx/progdlg.h> #include <wx/progdlg.h>
#include "define_new_memleakdetect.h"
#include "Utilities/Log.h" #include "Utilities/Log.h"
#include "Utilities/rFile.h" #include "Utilities/rFile.h"

View File

@ -0,0 +1,6 @@
//Override the new operator to use the memory leak detection from visual studio
//Does not work with placement new
#if defined(MSVC_CRT_MEMLEAK_DETECTION) && defined(_DEBUG) && defined(DBG_NEW)
#pragma push_macro("new")
#define new DBG_NEW
#endif

View File

@ -250,6 +250,7 @@
<ClInclude Include="Crypto\unpkg.h" /> <ClInclude Include="Crypto\unpkg.h" />
<ClInclude Include="Crypto\unself.h" /> <ClInclude Include="Crypto\unself.h" />
<ClInclude Include="Crypto\utils.h" /> <ClInclude Include="Crypto\utils.h" />
<ClInclude Include="define_new_memleakdetect.h" />
<ClInclude Include="Emu\ARMv7\ARMv7Decoder.h" /> <ClInclude Include="Emu\ARMv7\ARMv7Decoder.h" />
<ClInclude Include="Emu\ARMv7\ARMv7DisAsm.h" /> <ClInclude Include="Emu\ARMv7\ARMv7DisAsm.h" />
<ClInclude Include="Emu\ARMv7\ARMv7Interpreter.h" /> <ClInclude Include="Emu\ARMv7\ARMv7Interpreter.h" />
@ -416,6 +417,7 @@
<ClInclude Include="Loader\SELF.h" /> <ClInclude Include="Loader\SELF.h" />
<ClInclude Include="Loader\TROPUSR.h" /> <ClInclude Include="Loader\TROPUSR.h" />
<ClInclude Include="Loader\TRP.h" /> <ClInclude Include="Loader\TRP.h" />
<ClInclude Include="restore_new.h" />
<ClInclude Include="stdafx.h" /> <ClInclude Include="stdafx.h" />
</ItemGroup> </ItemGroup>
<PropertyGroup Label="Globals"> <PropertyGroup Label="Globals">

View File

@ -1204,5 +1204,11 @@
<ClInclude Include="Emu\SysCalls\Modules\cellSaveData.h"> <ClInclude Include="Emu\SysCalls\Modules\cellSaveData.h">
<Filter>Emu\SysCalls\Modules</Filter> <Filter>Emu\SysCalls\Modules</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="restore_new.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="define_new_memleakdetect.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
</Project> </Project>

5
rpcs3/restore_new.h Normal file
View File

@ -0,0 +1,5 @@
//Restore the new operator if previously saved before overriding
//Allow the use of placement new
#if defined(MSVC_CRT_MEMLEAK_DETECTION) && defined(_DEBUG) && defined(DBG_NEW)
#pragma pop_macro("new")
#endif

View File

@ -10,7 +10,7 @@
#if defined(MSVC_CRT_MEMLEAK_DETECTION) && defined(_DEBUG) && !defined(DBG_NEW) #if defined(MSVC_CRT_MEMLEAK_DETECTION) && defined(_DEBUG) && !defined(DBG_NEW)
#define DBG_NEW new ( _NORMAL_BLOCK , __FILE__ , __LINE__ ) #define DBG_NEW new ( _NORMAL_BLOCK , __FILE__ , __LINE__ )
#define new DBG_NEW #include "define_new_memleakdetect.h"
#endif #endif
// This header should be frontend-agnostic, so don't assume wx includes everything // This header should be frontend-agnostic, so don't assume wx includes everything