Click here to Skip to main content
15,917,328 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: how to get window color? Pin
VCProgrammer18-Jan-13 18:42
VCProgrammer18-Jan-13 18:42 
QuestionHow to draw a banner and button ? Pin
VCProgrammer15-Jan-13 20:24
VCProgrammer15-Jan-13 20:24 
AnswerRe: How to draw a banner and button ? Pin
_Flaviu15-Jan-13 20:49
_Flaviu15-Jan-13 20:49 
GeneralRe: How to draw a banner and button ? Pin
VCProgrammer15-Jan-13 21:08
VCProgrammer15-Jan-13 21:08 
GeneralRe: How to draw a banner and button ? Pin
_Flaviu15-Jan-13 21:26
_Flaviu15-Jan-13 21:26 
GeneralRe: How to draw a banner and button ? Pin
VCProgrammer15-Jan-13 21:34
VCProgrammer15-Jan-13 21:34 
GeneralRe: How to draw a banner and button ? Pin
_Flaviu15-Jan-13 22:14
_Flaviu15-Jan-13 22:14 
AnswerRe: How to draw a banner and button ? Pin
Richard MacCutchan15-Jan-13 22:46
mveRichard MacCutchan15-Jan-13 22:46 
Questionit's my first useful code.. and there's error that i can't understan :( Pin
eng.immortal15-Jan-13 18:20
eng.immortal15-Jan-13 18:20 
AnswerRe: it's my first useful code.. and there's error that i can't understan :( Pin
_Flaviu15-Jan-13 19:37
_Flaviu15-Jan-13 19:37 
AnswerRe: it's my first useful code.. and there's error that i can't understan :( Pin
«_Superman_»15-Jan-13 22:06
professional«_Superman_»15-Jan-13 22:06 
AnswerRe: it's my first useful code.. and there's error that i can't understan :( Pin
David Crow16-Jan-13 5:52
David Crow16-Jan-13 5:52 
AnswerRe: it's my first useful code.. and there's error that i can't understan :( Pin
Dean M. Sands, III17-Jan-13 3:11
Dean M. Sands, III17-Jan-13 3:11 
Questioncallback function gets called / executed with bad data Pin
Vaclav_15-Jan-13 9:46
Vaclav_15-Jan-13 9:46 
QuestionDoes anyone know this c plus plus knowledge? Pin
yu-jian15-Jan-13 5:16
yu-jian15-Jan-13 5:16 
AnswerRe: Does anyone know this c plus plus knowledge? Pin
Richard MacCutchan15-Jan-13 6:33
mveRichard MacCutchan15-Jan-13 6:33 
AnswerRe: Does anyone know this c plus plus knowledge? Pin
CPallini15-Jan-13 11:30
mveCPallini15-Jan-13 11:30 
GeneralRe: Does anyone know this c plus plus knowledge? Pin
yu-jian16-Jan-13 3:17
yu-jian16-Jan-13 3:17 
GeneralRe: Does anyone know this c plus plus knowledge? Pin
CPallini16-Jan-13 4:04
mveCPallini16-Jan-13 4:04 
GeneralRe: Does anyone know this c plus plus knowledge? Pin
yu-jian16-Jan-13 17:44
yu-jian16-Jan-13 17:44 
GeneralRe: Does anyone know this c plus plus knowledge? Pin
jschell16-Jan-13 9:10
jschell16-Jan-13 9:10 
AnswerRe: Does anyone know this c plus plus knowledge? Pin
JackDingler16-Jan-13 11:19
JackDingler16-Jan-13 11:19 
GeneralRe: Does anyone know this c plus plus knowledge? Pin
yu-jian16-Jan-13 17:50
yu-jian16-Jan-13 17:50 
GeneralRe: Does anyone know this c plus plus knowledge? Pin
JackDingler17-Jan-13 5:15
JackDingler17-Jan-13 5:15 
Questiondeque problem. Does this code has any problem? [solved] Pin
yu-jian14-Jan-13 3:47
yu-jian14-Jan-13 3:47 
C#
{
    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();
}

}



XML
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.

XML
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.

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.