Fix setting client data when adding items to a sorted wxListBox, broken in r74317

closes #16290


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76605 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Paul Cornett 2014-05-26 07:30:42 +00:00
parent 4b6c6a2fbd
commit 0b92a2083d
2 changed files with 7 additions and 2 deletions

View File

@ -460,9 +460,13 @@ int wxListBox::DoInsertOneItem(const wxString& item, unsigned int pos)
#else
int entryCol = 0;
#endif
gtk_list_store_insert_with_values(m_liststore, NULL, pos, entryCol, entry, -1);
GtkTreeIter iter;
gtk_list_store_insert_with_values(m_liststore, &iter, pos, entryCol, entry, -1);
g_object_unref(entry);
if (HasFlag(wxLB_SORT))
pos = GTKGetIndexFor(iter);
return pos;
}

View File

@ -122,9 +122,10 @@ void ListBoxTestCase::Sort()
CPPUNIT_ASSERT_EQUAL("aab", m_list->GetString(4));
CPPUNIT_ASSERT_EQUAL("aba", m_list->GetString(5));
m_list->Append("a");
m_list->Append("a", wxUIntToPtr(1));
CPPUNIT_ASSERT_EQUAL("a", m_list->GetString(0));
CPPUNIT_ASSERT_EQUAL(wxUIntToPtr(1), m_list->GetClientData(0));
#endif
}