X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/937013e0fd914d4c42f9f5ec98da665986b93dfa..81b0235f13a7e3cca27d1883d1098bfe285a9351:/src/gtk/choice.cpp diff --git a/src/gtk/choice.cpp b/src/gtk/choice.cpp index 294d977377..af2b1092fd 100644 --- a/src/gtk/choice.cpp +++ b/src/gtk/choice.cpp @@ -222,8 +222,8 @@ void wxChoice::DoDeleteOneItem(unsigned int n) wxArrayString items; wxArrayPtrVoid itemsData; - items.Alloc(count); - itemsData.Alloc(count); + items.Alloc(count - 1); + itemsData.Alloc(count - 1); for ( unsigned i = 0; i < count; i++ ) { if ( i != n ) @@ -235,11 +235,15 @@ void wxChoice::DoDeleteOneItem(unsigned int n) wxChoice::DoClear(); - void ** const data = &itemsData[0]; - if ( HasClientObjectData() ) - Append(items, wx_reinterpret_cast(wxClientData **, data)); - else - Append(items, data); + if ( count > 1 ) + { + void ** const data = &itemsData[0]; + if ( HasClientObjectData() ) + Append(items, wx_reinterpret_cast(wxClientData **, data)); + else + Append(items, data); + } + //else: the control is now empty, nothing to append } int wxChoice::FindString( const wxString &string, bool bCase ) const