diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index 8142a35518..68a3ff3de1 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -96,9 +96,11 @@ static const int MARGIN_AROUND_CHECKBOX = 5; // ---------------------------------------------------------------------------- wxListItemData::wxListItemData(wxListItemData&& other) + : m_image(other.m_image), + m_data(other.m_data), + m_owner(other.m_owner), + m_text(std::move(other.m_text)) { - m_owner = other.m_owner; - // Take ownership of the pointers from the other object and reset them. std::swap(m_attr, other.m_attr); std::swap(m_rect, other.m_rect); @@ -109,6 +111,7 @@ wxListItemData& wxListItemData::operator=(wxListItemData&& other) m_image = other.m_image; m_data = other.m_data; m_owner = other.m_owner; + m_text = std::move(other.m_text); // Swap them to let our pointers be deleted by the other object if necessary. std::swap(m_attr, other.m_attr); diff --git a/tests/controls/listviewtest.cpp b/tests/controls/listviewtest.cpp index 636903c4b3..1c2cec91ad 100644 --- a/tests/controls/listviewtest.cpp +++ b/tests/controls/listviewtest.cpp @@ -105,4 +105,19 @@ TEST_CASE_METHOD(ListViewTestCase, "ListView::Focus", "[listctrl][listview]") CHECK( m_list->GetFocusedItem() == 0 ); } +TEST_CASE_METHOD(ListViewTestCase, "ListView::AppendColumn", "[listctrl][listview]") +{ + m_list->AppendColumn("Column 0"); + m_list->AppendColumn("Column 1"); + + m_list->InsertItem(0, "First item"); + m_list->SetItem(0, 1, "First subitem"); + + // Appending a column shouldn't change the existing items. + m_list->AppendColumn("Column 2"); + + CHECK( m_list->GetItemText(0) == "First item" ); + CHECK( m_list->GetItemText(0, 1) == "First subitem" ); +} + #endif