fixed memory leak

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36227 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
David Surovell 2005-11-22 16:15:46 +00:00
parent 0c38974967
commit 2c62259349

View File

@ -509,6 +509,12 @@ bool wxToolBar::DoDeleteTool(size_t pos, wxToolBarToolBase *tool)
void wxToolBar::CreateDisabledImageList() void wxToolBar::CreateDisabledImageList()
{ {
if (m_disabledImgList != NULL)
{
delete m_disabledImgList;
m_disabledImgList = NULL;
}
// as we can't use disabled image list with older versions of comctl32.dll, // as we can't use disabled image list with older versions of comctl32.dll,
// don't even bother creating it // don't even bother creating it
if ( wxTheApp->GetComCtl32Version() >= 470 ) if ( wxTheApp->GetComCtl32Version() >= 470 )
@ -528,14 +534,12 @@ void wxToolBar::CreateDisabledImageList()
bmpDisabled.GetMask() != NULL, bmpDisabled.GetMask() != NULL,
GetToolsCount() GetToolsCount()
); );
return; break;
} }
} }
// we don't have any disabled bitmaps // we don't have any disabled bitmaps
} }
m_disabledImgList = NULL;
} }
bool wxToolBar::Realize() bool wxToolBar::Realize()
@ -631,8 +635,6 @@ bool wxToolBar::Realize()
totalBitmapWidth, totalBitmapHeight); totalBitmapWidth, totalBitmapHeight);
dcAllButtons.SelectObject(bitmap); dcAllButtons.SelectObject(bitmap);
} }
#endif // !__WXWINCE__ #endif // !__WXWINCE__
@ -726,8 +728,6 @@ bool wxToolBar::Realize()
// Map to system colours // Map to system colours
hBitmap = (HBITMAP)MapBitmap((WXHBITMAP) hBitmap, hBitmap = (HBITMAP)MapBitmap((WXHBITMAP) hBitmap,
totalBitmapWidth, totalBitmapHeight); totalBitmapWidth, totalBitmapHeight);
} }
bool addBitmap = true; bool addBitmap = true;