use the correct c++ deleters

This commit is contained in:
Ian Curtis 2018-01-06 11:19:04 +00:00
parent 19e6aab1fa
commit dc3048df24
2 changed files with 21 additions and 30 deletions

View file

@ -90,6 +90,14 @@
#define DPRINTF(a, ...)
#endif
#ifndef SAFE_DELETE
#define SAFE_DELETE(p) delete (p); (p) = NULL;
#endif
#ifndef SAFE_ARRAY_DELETE
#define SAFE_ARRAY_DELETE(x) delete[] x; x = NULL;
#endif
using namespace SMUDP;
static int(*Runnet68kCB)(int cycles);
@ -1225,6 +1233,8 @@ bool CNetBoard::Init(UINT8 * netRAMPtr, UINT8 *netBufferPtr)
CNetBoard::CNetBoard(const Util::Config::Node &config) : m_config(config)
{
memoryPool = NULL;
bank = NULL;
ct = NULL;
netRAM = NULL;
netBuffer = NULL;
Buffer = NULL;
@ -1232,7 +1242,6 @@ CNetBoard::CNetBoard(const Util::Config::Node &config) : m_config(config)
CommRAM = NULL;
ioreg = NULL;
ctrlrw = NULL;
bank = NULL;
CodeReady = false;
test_irq = 0;
@ -1242,32 +1251,18 @@ CNetBoard::CNetBoard(const Util::Config::Node &config) : m_config(config)
CNetBoard::~CNetBoard(void)
{
if (memoryPool != NULL)
{
delete[] memoryPool;
memoryPool = NULL;
}
SAFE_ARRAY_DELETE(memoryPool);
SAFE_ARRAY_DELETE(bank);
SAFE_ARRAY_DELETE(ct);
netRAM = NULL;
netBuffer = NULL;
Buffer = NULL;
RAM = NULL;
CommRAM = NULL;
ioreg = NULL;
ctrlrw = NULL;
if (bank != NULL)
{
delete bank;
bank = NULL;
}
if (ct != NULL)
{
delete ct;
ct = NULL;
}
netRAM = NULL;
netBuffer = NULL;
Buffer = NULL;
RAM = NULL;
CommRAM = NULL;
ioreg = NULL;
ctrlrw = NULL;
/*if (int5 == true)
{
int5 = false;
@ -1290,9 +1285,6 @@ bool CNetBoard::RunFrame(void)
return true;
}
M68KSetContext(&M68K);
/*if (int5 == false)

View file

@ -54,7 +54,6 @@ private:
UINT8 *ioreg;
UINT8 *ctrlrw;
UINT8 *Buffer;
UINT8 *Buffer2;
UINT8 *RAM;
UINT8 *ct;