|
{
CTempLock tempLock(&m_FrameListLock);
if (m_FrameQueue.size() == 0) return 0L;
pFrameData = m_FrameQueue.front();
m_FrameQueue.pop_front();
}
if (WaitForSingleObject(this->m_hCloseEvent, 0) == WAIT_OBJECT_0)
{
return ZMD_OK;
}
try
{
if (pFrameData != NULL)
{
if (pFrameData->lpData != NULL)
{
try
{
this->DistributeFrame(pFrameData->lpData, pFrameData->iSize);
byte* pBuf = reinterpret_cast<byte*>(pFrameData->lpData);
delete[] pBuf;
}
catch (CException* e)
{
e->Delete();
}
}
delete pFrameData;
pFrameData = NULL;
}
}
catch (CException* e)
{
e->Delete();
}
}
There is a error that happens in the following code.
byte* pBuf = reinterpret_cast<byte*>(pFrameData->lpData);
<b>delete[] pBuf;</b>
Just as the image, here.
https://www.dropbox.com/s/ckqkz88qnifus4g/Error.png
I find that the pFrameData->lpData is a wild buffer point. I do not know when the buffer is released? Or this deque has some problem?
The class is here.
class CStreamProcess
{
HRESULT ProcessFrames();
void DistributeFrame(const LPVOID const lpBuf, int dwSize);
HANDLE m_hCloseEvent;
HANDLE m_hFrameProcessEvent;
std::deque<SZMDFrameData> m_FrameQueue;
CCriticalSection m_FrameListLock;
};
--------------------
I have resolved this problem. Its a mistake of using CCriticalSection.
modified 15-Jan-13 3:35am.
|
|
|
|
|
|
Hi CPallini,
Thank you very much. You help me greatly.
|
|
|
|
|
Not this problem, I made a test that has a temporary class. CMyClass. When pop_front() the desconstructor function of class CMyClass will not be called.
|
|
|
|