Fix client data handling: delete client data for all items when a

wxChoice is deleted, delete client data for an item when that item is
deleted.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19084 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Mattia Barbon 2003-02-02 21:00:06 +00:00
parent ab9f788e31
commit d76240bfe1
4 changed files with 28 additions and 4 deletions

View File

@ -21,7 +21,15 @@ IMPLEMENT_DYNAMIC_CLASS(wxChoice, wxControl)
extern MenuHandle NewUniqueMenu() ;
wxChoice::~wxChoice()
{
// DeleteMenu( m_macPopUpMenuId ) ;
if ( HasClientObjectData() )
{
size_t i, max = GetCount();
for ( i = 0; i < max; ++i )
delete GetClientObject(i);
}
// DeleteMenu( m_macPopUpMenuId ) ;
// DisposeMenu( m_macPopUpMenuHandle ) ;
}
bool wxChoice::Create(wxWindow *parent, wxWindowID id,
@ -221,4 +229,4 @@ wxSize wxChoice::DoGetBestSize() const
}
return wxSize(lbWidth, lbHeight);
}
}

View File

@ -408,6 +408,10 @@ void wxComboBox::Append(const wxString& item)
void wxComboBox::Delete(int n)
{
if ( HasClientObjectData() )
{
SetClientObject(n, NULL);
}
m_choice->Delete( n );
}

View File

@ -21,7 +21,15 @@ IMPLEMENT_DYNAMIC_CLASS(wxChoice, wxControl)
extern MenuHandle NewUniqueMenu() ;
wxChoice::~wxChoice()
{
// DeleteMenu( m_macPopUpMenuId ) ;
if ( HasClientObjectData() )
{
size_t i, max = GetCount();
for ( i = 0; i < max; ++i )
delete GetClientObject(i);
}
// DeleteMenu( m_macPopUpMenuId ) ;
// DisposeMenu( m_macPopUpMenuHandle ) ;
}
bool wxChoice::Create(wxWindow *parent, wxWindowID id,
@ -221,4 +229,4 @@ wxSize wxChoice::DoGetBestSize() const
}
return wxSize(lbWidth, lbHeight);
}
}

View File

@ -408,6 +408,10 @@ void wxComboBox::Append(const wxString& item)
void wxComboBox::Delete(int n)
{
if ( HasClientObjectData() )
{
SetClientObject(n, NULL);
}
m_choice->Delete( n );
}