Resource leak?
-
BoundsChecker v7 is reporting the error 'Argument 2 in ReleaseDC (HDC__ hdc = 0xE00105F5) still contains non default/stock objects.' in the d'tor for CClientDC in the code:
void CHListBox::updateWidth(LPCTSTR s)
{
CClientDC dc(this);
CFont * f = CListBox::GetFont();
CFont* pOldFont = dc.SelectObject(f);CSize sz = dc.GetTextExtent(s, \_tcslen(s)); dc.SelectObject(pOldFont); sz.cx += 3 \* ::GetSystemMetrics(SM\_CXBORDER); if (sz.cx > width) { /\* extend \*/ width = sz.cx; CListBox::SetHorizontalExtent(width); } /\* extend \*/
}
I'm fairly confident that there is no leak. Do you agree? Gavin
-
BoundsChecker v7 is reporting the error 'Argument 2 in ReleaseDC (HDC__ hdc = 0xE00105F5) still contains non default/stock objects.' in the d'tor for CClientDC in the code:
void CHListBox::updateWidth(LPCTSTR s)
{
CClientDC dc(this);
CFont * f = CListBox::GetFont();
CFont* pOldFont = dc.SelectObject(f);CSize sz = dc.GetTextExtent(s, \_tcslen(s)); dc.SelectObject(pOldFont); sz.cx += 3 \* ::GetSystemMetrics(SM\_CXBORDER); if (sz.cx > width) { /\* extend \*/ width = sz.cx; CListBox::SetHorizontalExtent(width); } /\* extend \*/
}
I'm fairly confident that there is no leak. Do you agree? Gavin
-
BoundsChecker v7 is reporting the error 'Argument 2 in ReleaseDC (HDC__ hdc = 0xE00105F5) still contains non default/stock objects.' in the d'tor for CClientDC in the code:
void CHListBox::updateWidth(LPCTSTR s)
{
CClientDC dc(this);
CFont * f = CListBox::GetFont();
CFont* pOldFont = dc.SelectObject(f);CSize sz = dc.GetTextExtent(s, \_tcslen(s)); dc.SelectObject(pOldFont); sz.cx += 3 \* ::GetSystemMetrics(SM\_CXBORDER); if (sz.cx > width) { /\* extend \*/ width = sz.cx; CListBox::SetHorizontalExtent(width); } /\* extend \*/
}
I'm fairly confident that there is no leak. Do you agree? Gavin
Gavin Jerman wrote: I'm fairly confident that there is no leak. Do you agree? Yes. - Anders Money talks, but all mine ever says is "Goodbye!"