Disclaimer: I have zero knowledge of Linux (I ran into this by accident when testing my wxSystemInformationFrame), so it is possible I am doing something wrong.
Bug description
With GTK3 and wxWidgets 3.3, when having wxListCtrl in report mode with existing items, calling AppendColumn() sets the items text in existing columns to empty strings. This does not happen on the same system with 3.2 built exactly the same way (CMake) and using the same compile- and run-time GTK version.
Item data seem to be cleared as well.
To reproduce
- Patch the minimal sample with the patch below.
- Build and run the sample.
- Invoke Help/About menu command.
- Observe that the list appears empty (but the items are still there).
diff --git a/samples/minimal/minimal.cpp b/samples/minimal/minimal.cpp
index 5f32257c6b..4e36c8178b 100644
--- a/samples/minimal/minimal.cpp
+++ b/samples/minimal/minimal.cpp
@@ -25,6 +25,7 @@
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
+#include "wx/listctrl.h"
// ----------------------------------------------------------------------------
// resources
@@ -65,6 +66,7 @@ public:
void OnAbout(wxCommandEvent& event);
private:
+ wxListView* m_listView;
// any class wishing to process wxWidgets events must use this macro
wxDECLARE_EVENT_TABLE();
};
@@ -175,6 +177,14 @@ MyFrame::MyFrame(const wxString& title)
CreateStatusBar(2);
SetStatusText("Welcome to wxWidgets!");
#endif // wxUSE_STATUSBAR
+ m_listView = new wxListView(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT);
+ m_listView->AppendColumn("Column 0");
+ m_listView->AppendColumn("Column 1");
+ for ( int i = 0; i < 5; ++i )
+ {
+ m_listView->InsertItem(m_listView->GetItemCount(), wxString::Format("Item %d", i));
+ m_listView->SetItem(i, 1, wxString::Format("SubItem %d", i));
+ }
}
@@ -188,6 +198,9 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{
+ wxLogMessage("Item 0 text before AppendColumn(): '%s'", m_listView->GetItemText(0));
+ m_listView->AppendColumn("Appended");
+ wxLogMessage("Item 0 text after AppendColumn(): '%s'", m_listView->GetItemText(0));
wxMessageBox(wxString::Format
(
"Welcome to %s!\n"
I could not simply reproduce in the listctrl sample, but there is a lot going on there...
Platform and version information
- wxWidgets version: master
- wxWidgets port: wxGTK
- OS: Ubuntu 24.04.2 (observed also on Mint 22 Cinnamon)
- GTK version: 3.24.41 both compile- and run-time
- Which GDK: default
- Desktop environment: default
- Current theme: default (Yaru)