Increase usage of safe delete and release templates

refs #564
This commit is contained in:
Roland Winklmeier
2016-01-04 15:57:08 +01:00
parent 4d6c92e6c8
commit 41da652b96
5 changed files with 7 additions and 16 deletions

View File

@@ -41,7 +41,7 @@ namespace BlackSimPlugin
m_directPlayPeer->Release();
}
if (m_deviceAddress) m_deviceAddress->Release();
SafeRelease(m_deviceAddress);
CoUninitialize();
}

View File

@@ -122,8 +122,7 @@ namespace BlackSimPlugin
CFs9Client::~CFs9Client()
{
if (m_hostAddress) m_hostAddress->Release();
m_hostAddress = nullptr;
SafeRelease(m_hostAddress);
}
void CFs9Client::sendTextMessage(const QString &textMessage)

View File

@@ -56,10 +56,7 @@ namespace BlackSimPlugin
for (uint ii = 0; ii < dwNumAddresses; ++ii)
{
LPDIRECTPLAY8ADDRESS pAddress = addresses[ii];
if (pAddress)
{
pAddress->Release();
}
SafeRelease(pAddress);
}
}
return address;

View File

@@ -8,6 +8,7 @@
*/
#include "hostnode.h"
#include "directplayutils.h"
namespace BlackSimPlugin
{
@@ -25,10 +26,7 @@ namespace BlackSimPlugin
CHostNode::~CHostNode()
{
if (m_hostAddress)
m_hostAddress->Release();
m_hostAddress = nullptr;
SafeRelease(m_hostAddress);
}
}
}

View File

@@ -41,11 +41,8 @@ namespace BlackSimPlugin
m_directPlayPeer->Release();
}
if (m_deviceAddress)
m_deviceAddress->Release();
if (m_hostAddress)
m_hostAddress->Release();
SafeRelease(m_deviceAddress);
SafeRelease(m_hostAddress);
if (m_dpLobbyClient)
{