From: Vadim Zeitlin Date: Mon, 2 Jul 2012 15:03:08 +0000 (+0000) Subject: Keep client data in sync when deleting items from wxOSX wxComboBox. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/d8c0d15d32ed5a362a8ef6a6a54de1f5bdbaf7f2 Keep client data in sync when deleting items from wxOSX wxComboBox. Correspondence between item indices and their client data was broken if any items were deleted or the combobox was cleared entirely. Fix this by updating the client data array whenever this happens. Closes #14147. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71943 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/osx/combobox_osx.cpp b/src/osx/combobox_osx.cpp index 9a1f1b75e2..00a8e571fe 100644 --- a/src/osx/combobox_osx.cpp +++ b/src/osx/combobox_osx.cpp @@ -131,11 +131,13 @@ unsigned int wxComboBox::GetCount() const void wxComboBox::DoDeleteOneItem(unsigned int n) { + m_datas.RemoveAt(n); GetComboPeer()->RemoveItem(n); } void wxComboBox::DoClear() { + m_datas.Clear(); GetComboPeer()->Clear(); }