don't append anything back in DoDeleteOneItem() if the control becomes empty (fixes bug 1880411)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51389 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user