diff --git a/src/mac/carbon/choice.cpp b/src/mac/carbon/choice.cpp index 46e08be0d5..ac29f3125b 100644 --- a/src/mac/carbon/choice.cpp +++ b/src/mac/carbon/choice.cpp @@ -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); -} \ No newline at end of file +} diff --git a/src/mac/carbon/combobox.cpp b/src/mac/carbon/combobox.cpp index 664d142f40..feee187143 100644 --- a/src/mac/carbon/combobox.cpp +++ b/src/mac/carbon/combobox.cpp @@ -408,6 +408,10 @@ void wxComboBox::Append(const wxString& item) void wxComboBox::Delete(int n) { + if ( HasClientObjectData() ) + { + SetClientObject(n, NULL); + } m_choice->Delete( n ); } diff --git a/src/mac/choice.cpp b/src/mac/choice.cpp index 46e08be0d5..ac29f3125b 100644 --- a/src/mac/choice.cpp +++ b/src/mac/choice.cpp @@ -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); -} \ No newline at end of file +} diff --git a/src/mac/combobox.cpp b/src/mac/combobox.cpp index 664d142f40..feee187143 100644 --- a/src/mac/combobox.cpp +++ b/src/mac/combobox.cpp @@ -408,6 +408,10 @@ void wxComboBox::Append(const wxString& item) void wxComboBox::Delete(int n) { + if ( HasClientObjectData() ) + { + SetClientObject(n, NULL); + } m_choice->Delete( n ); }