Fixed close null mutex and condvar

This commit is contained in:
Xinyu Hou 2014-11-25 11:30:47 +00:00
parent f022d814e6
commit c560eabeb2
2 changed files with 15 additions and 5 deletions

View File

@ -96,7 +96,8 @@ ArchNetAddressImpl::alloc(size_t size)
// ArchNetworkWinsock
//
ArchNetworkWinsock::ArchNetworkWinsock()
ArchNetworkWinsock::ArchNetworkWinsock() :
m_mutex(NULL)
{
}
@ -109,7 +110,9 @@ ArchNetworkWinsock::~ArchNetworkWinsock()
WSACleanup_winsock = NULL;
s_networkModule = NULL;
}
if (m_mutex != NULL) {
ARCH->closeMutex(m_mutex);
}
EventList::iterator it;
for (it = m_unblockEvents.begin(); it != m_unblockEvents.end(); it++) {

View File

@ -39,7 +39,10 @@ static const UINT kFirstReceiverID = WM_USER + 14;
ArchTaskBarWindows* ArchTaskBarWindows::s_instance = NULL;
ArchTaskBarWindows::ArchTaskBarWindows() :
m_nextID(kFirstReceiverID)
m_nextID(kFirstReceiverID),
m_thread(NULL),
m_condVar(NULL),
m_mutex(NULL)
{
// save the singleton instance
s_instance = this;
@ -52,8 +55,12 @@ ArchTaskBarWindows::~ArchTaskBarWindows()
ARCH->wait(m_thread, -1.0);
ARCH->closeThread(m_thread);
}
if (m_condVar != NULL) {
ARCH->closeCondVar(m_condVar);
}
if (m_mutex != NULL) {
ARCH->closeMutex(m_mutex);
}
s_instance = NULL;
}