ccbuluo / duilib

Automatically exported from code.google.com/p/duilib
0 stars 0 forks source link

paintmanger KillTimer 的时候有个内存泄露 #26

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
void CPaintManagerUI::KillTimer(CControlUI* pControl)
{
    ASSERT(pControl!=NULL);
    int count = m_aTimers.GetSize();
    for( int i = 0, j = 0; i < count; i++ ) {
        TIMERINFO* pTimer = static_cast<TIMERINFO*>(m_aTimers[i - j]);
        if( pTimer->pSender == pControl && pTimer->hWnd == m_hWndPaint ) {
            if( pTimer->bKilled == false ) ::KillTimer(pTimer->hWnd, pTimer->uWinTimer);
            m_aTimers.Remove(i - j);
            delete pTimer;   // 这里应该删掉 pTimer
            j++;
        }
    }
}

Original issue reported on code.google.com by tbxyww@gmail.com on 21 Mar 2012 at 2:39