X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e71a0aa95f767ab0302607b3c94dc155d72d5e61..7a21e692d22ec16a5de7dbbb73761d4c4456edaa:/src/mac/combobox.cpp diff --git a/src/mac/combobox.cpp b/src/mac/combobox.cpp index 830e8564a7..27aa1a58de 100644 --- a/src/mac/combobox.cpp +++ b/src/mac/combobox.cpp @@ -162,7 +162,10 @@ END_EVENT_TABLE() wxComboBox::~wxComboBox() { - // delete the controls now, don't leave them alive even though they would + // delete client objects + FreeData(); + + // delete the controls now, don't leave them alive even though they would // still be eventually deleted by our parent - but it will be too late, the // user code expects them to be gone now if (m_text != NULL) { @@ -253,6 +256,22 @@ void wxComboBox::DelegateChoice( const wxString& value ) } +bool wxComboBox::Create(wxWindow *parent, wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style, + const wxValidator& validator, + const wxString& name) +{ + wxCArrayString chs( choices ); + + return Create( parent, id, value, pos, size, chs.GetCount(), + chs.GetStrings(), style, validator, name ); +} + + bool wxComboBox::Create(wxWindow *parent, wxWindowID id, const wxString& value, const wxPoint& pos, @@ -414,31 +433,47 @@ int wxComboBox::DoInsert(const wxString& item, int pos) void wxComboBox::DoSetItemClientData(int n, void* clientData) { - return m_choice->SetClientData( n , clientData ) ; + return m_choice->DoSetItemClientData( n , clientData ) ; } void* wxComboBox::DoGetItemClientData(int n) const { - return m_choice->GetClientData( n ) ; + return m_choice->DoGetItemClientData( n ) ; } void wxComboBox::DoSetItemClientObject(int n, wxClientData* clientData) { - return m_choice->SetClientObject( n , clientData ) ; + return m_choice->DoSetItemClientObject( n , clientData ) ; } wxClientData* wxComboBox::DoGetItemClientObject(int n) const { - return m_choice->GetClientObject( n ) ; + return m_choice->DoGetItemClientObject( n ) ; +} + +void wxComboBox::FreeData() +{ + if ( HasClientObjectData() ) + { + size_t count = GetCount(); + for ( size_t n = 0; n < count; n++ ) + { + SetClientObject( n, NULL ); + } + } } void wxComboBox::Delete(int n) { + // force client object deletion + if( HasClientObjectData() ) + SetClientObject( n, NULL ); m_choice->Delete( n ); } void wxComboBox::Clear() { + FreeData(); m_choice->Clear(); }