]> git.saurik.com Git - wxWidgets.git/commitdiff
Keep client data in sync when deleting items from wxOSX wxComboBox.
authorVadim Zeitlin <vadim@wxwidgets.org>
Mon, 2 Jul 2012 15:03:08 +0000 (15:03 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Mon, 2 Jul 2012 15:03:08 +0000 (15:03 +0000)
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

src/osx/combobox_osx.cpp

index 9a1f1b75e22ddada20d7fdb0c237eedd0072327d..00a8e571fe659f939354c47020c3096c55735317 100644 (file)
@@ -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();
 }