avoid leaking allocated tooltips

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60788 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Francesco Montorsi
2009-05-28 20:31:38 +00:00
parent bba60a82b9
commit 421962befc

View File

@@ -153,6 +153,16 @@ wxStatusBar::~wxStatusBar()
// occupy // occupy
PostSizeEventToParent(); PostSizeEventToParent();
// delete existing tooltips
for (size_t i=0; i<m_tooltips.size(); i++)
{
if (m_tooltips[i])
{
delete m_tooltips[i];
m_tooltips[i] = NULL;
}
}
wxDELETE(m_pDC); wxDELETE(m_pDC);
} }
@@ -178,10 +188,13 @@ void wxStatusBar::SetFieldsCount(int nFields, const int *widths)
// reset all current tooltips // reset all current tooltips
for (size_t i=0; i<m_tooltips.size(); i++) for (size_t i=0; i<m_tooltips.size(); i++)
{
if (m_tooltips[i])
{ {
delete m_tooltips[i]; delete m_tooltips[i];
m_tooltips[i] = NULL; m_tooltips[i] = NULL;
} }
}
// shrink/expand the array: // shrink/expand the array:
m_tooltips.resize(m_panes.GetCount(), NULL); m_tooltips.resize(m_panes.GetCount(), NULL);