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;
|
wxArrayString items;
|
||||||
wxArrayPtrVoid itemsData;
|
wxArrayPtrVoid itemsData;
|
||||||
items.Alloc(count);
|
items.Alloc(count - 1);
|
||||||
itemsData.Alloc(count);
|
itemsData.Alloc(count - 1);
|
||||||
for ( unsigned i = 0; i < count; i++ )
|
for ( unsigned i = 0; i < count; i++ )
|
||||||
{
|
{
|
||||||
if ( i != n )
|
if ( i != n )
|
||||||
@@ -235,11 +235,15 @@ void wxChoice::DoDeleteOneItem(unsigned int n)
|
|||||||
|
|
||||||
wxChoice::DoClear();
|
wxChoice::DoClear();
|
||||||
|
|
||||||
void ** const data = &itemsData[0];
|
if ( count > 1 )
|
||||||
if ( HasClientObjectData() )
|
{
|
||||||
Append(items, wx_reinterpret_cast(wxClientData **, data));
|
void ** const data = &itemsData[0];
|
||||||
else
|
if ( HasClientObjectData() )
|
||||||
Append(items, data);
|
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
|
int wxChoice::FindString( const wxString &string, bool bCase ) const
|
||||||
|
Reference in New Issue
Block a user