set pointers to null and call uninit

This commit is contained in:
sijchen 2016-02-16 12:17:21 -08:00
parent cc675f9fd1
commit 74955c877f
2 changed files with 18 additions and 0 deletions

View File

@ -52,16 +52,28 @@ CWelsThreadPool::CWelsThreadPool (IWelsThreadPoolSink* pSink, int32_t iMaxThread
if (NULL == m_cWaitedTasks || NULL == m_cIdleThreads || NULL == m_cBusyThreads) {
delete m_cWaitedTasks;
m_cWaitedTasks = NULL;
delete m_cIdleThreads;
m_cIdleThreads = NULL;
delete m_cBusyThreads;
m_cBusyThreads = NULL;
return;
}
if (WELS_THREAD_ERROR_OK != Init (iMaxThreadNum)) {
Uninit();
delete m_cWaitedTasks;
m_cWaitedTasks = NULL;
delete m_cIdleThreads;
m_cIdleThreads = NULL;
delete m_cBusyThreads;
m_cBusyThreads = NULL;
}
}
@ -70,8 +82,13 @@ CWelsThreadPool::~CWelsThreadPool() {
Uninit();
delete m_cWaitedTasks;
m_cWaitedTasks = NULL;
delete m_cIdleThreads;
m_cIdleThreads = NULL;
delete m_cBusyThreads;
m_cBusyThreads = NULL;
}
WELS_THREAD_ERROR_CODE CWelsThreadPool::OnTaskStart (CWelsTaskThread* pThread, IWelsTask* pTask) {

View File

@ -66,6 +66,7 @@ IWelsTaskManage* IWelsTaskManage::CreateTaskManage (sWelsEncCtx* pCtx, const i
WELS_VERIFY_RETURN_IF (NULL, NULL == pTaskManage)
if ( ENC_RETURN_SUCCESS != pTaskManage->Init (pCtx) ) {
pTaskManage->Uninit();
delete pTaskManage;
pTaskManage = NULL;
}